#~~~~~~~~ res2 = OLS(y, X).fit() #print "estimated parameters: x d1-d0 d2-d0 constant" print(res2.params) #print "standard deviation of parameter estimates" print(res2.bse) prstd, iv_l, iv_u = wls_prediction_std(res2) #print res.summary() #plot #~~~~ plt.figure() plt.plot(x1, y, 'o', x1, y_true, 'b-') plt.plot(x1, res2.fittedvalues, 'r--.') plt.plot(x1, iv_u, 'r--') plt.plot(x1, iv_l, 'r--') plt.title('3 groups: different intercepts, common slope; blue: true, red: OLS') plt.show() #Test hypothesis that all groups have same intercept #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ R = [[0, 1, 0, 0], [0, 0, 1, 0]] # F test joint hypothesis R * beta = 0 # i.e. coefficient on both dummy variables equal zero print "Test hypothesis that all groups have same intercept" print res2.f_test(R)