Restrict with Interval
Posted: Thu Oct 01, 2015 7:16 pm
Dear Tom,
Thank you very much for your wonderful help so far.
I have another problem now. I have to find how to run a linear regression with interval restrictions on coefficients.
1. In case 1 I have written a code restricted the coefficient to be a certain value.
linreg(robusterrors, define=case4) DEPENDENT sambeg samend residModXLG4_11 coefModXLG4_11
# constant YOY%_SP500{1} BAA{2} YOY%_OIL{2} YOY%_CPI TR10Y{1} YOY%_HPI{1} TR3M YOY%_CRE UR
restrict(create, define=eq1) 10 residModXLG4b_11
#1
#1 alpha
#2
#1 beta1
#3
#1 beta2
#4
#1 beta3
#5
#1 beta4
#6
#1 beta5
#7
#1 beta6
#8
#1 beta7
#9
#1 beta8
#10
#1 beta9
Alpha and betas are taken from the previous regression:
linreg(robusterrors) DEPENDENT sambeg samend residModXLG4_1 coefModXLG4_1
# constant YOY%_SP500{1}
compute alpha1 = %beta(1), beta1 = %beta(2)
dis 'alpha1= ' alpha1 'beta1= ' beta1
linreg(robusterrors) residModXLG4_1 sambeg samend residModXLG4_2 coefModXLG4_2
# constant BAA{2}
compute alpha2 = %beta(1), beta2 = %beta(2)
dis 'alpha2 = ' alpha2 'beta2 = ' beta2
linreg(robusterrors) residModXLG4_2 sambeg samend residModXLG4_3 coefModXLG4_3
# constant YOY%_OIL{2}
compute alpha3 = %beta(1), beta3 = %beta(2)
dis 'alpha3= ' alpha3 'beta3= ' beta3
linreg(robusterrors) residModXLG4_3 sambeg samend residModXLG4_4 coefModXLG4_4
# constant YOY%_CPI
compute alpha4 = %beta(1), beta4 = %beta(2)
dis 'alpha4= ' alpha4 'beta4= ' beta4
linreg(robusterrors) residModXLG4_4 sambeg samend residModXLG4_5 coefModXLG4_5
# constant TR10Y{1}
compute alpha5 = %beta(1), beta5 = %beta(2)
dis 'alpha5= ' alpha5 'beta5= ' beta5
linreg(robusterrors) residModXLG4_5 sambeg samend residModXLG4_6 coefModXLG4_6
# constant YOY%_HPI{1}
compute alpha6 = %beta(1), beta6 = %beta(2)
dis 'alpha6= ' alpha6 'beta6= ' beta6
linreg(robusterrors) residModXLG4_6 sambeg samend residModXLG4_7 coefModXLG4_7
# constant TR3M
compute alpha7 = %beta(1), beta7 = %beta(2)
dis 'alpha7= ' alpha7 'beta7= ' beta7
linreg(robusterrors) residModXLG4_7 sambeg samend residModXLG4_8 coefModXLG4_8
# constant YOY%_CRE
compute alpha8 = %beta(1), beta8 = %beta(2)
dis 'alpha8= ' alpha8 'beta8= ' beta8
linreg(robusterrors) residModXLG4_8 sambeg samend residModXLG4_9 coefModXLG4_9
# constant UR
compute alpha9 = %beta(1), beta9 = %beta(2)
dis 'alpha9 = ' alpha9 'beta9 = ' beta9
But how how to restrict,say, constant to be positive and fall between 5 and 10.
Thank you very much.
Yelena
Thank you very much for your wonderful help so far.
I have another problem now. I have to find how to run a linear regression with interval restrictions on coefficients.
1. In case 1 I have written a code restricted the coefficient to be a certain value.
linreg(robusterrors, define=case4) DEPENDENT sambeg samend residModXLG4_11 coefModXLG4_11
# constant YOY%_SP500{1} BAA{2} YOY%_OIL{2} YOY%_CPI TR10Y{1} YOY%_HPI{1} TR3M YOY%_CRE UR
restrict(create, define=eq1) 10 residModXLG4b_11
#1
#1 alpha
#2
#1 beta1
#3
#1 beta2
#4
#1 beta3
#5
#1 beta4
#6
#1 beta5
#7
#1 beta6
#8
#1 beta7
#9
#1 beta8
#10
#1 beta9
Alpha and betas are taken from the previous regression:
linreg(robusterrors) DEPENDENT sambeg samend residModXLG4_1 coefModXLG4_1
# constant YOY%_SP500{1}
compute alpha1 = %beta(1), beta1 = %beta(2)
dis 'alpha1= ' alpha1 'beta1= ' beta1
linreg(robusterrors) residModXLG4_1 sambeg samend residModXLG4_2 coefModXLG4_2
# constant BAA{2}
compute alpha2 = %beta(1), beta2 = %beta(2)
dis 'alpha2 = ' alpha2 'beta2 = ' beta2
linreg(robusterrors) residModXLG4_2 sambeg samend residModXLG4_3 coefModXLG4_3
# constant YOY%_OIL{2}
compute alpha3 = %beta(1), beta3 = %beta(2)
dis 'alpha3= ' alpha3 'beta3= ' beta3
linreg(robusterrors) residModXLG4_3 sambeg samend residModXLG4_4 coefModXLG4_4
# constant YOY%_CPI
compute alpha4 = %beta(1), beta4 = %beta(2)
dis 'alpha4= ' alpha4 'beta4= ' beta4
linreg(robusterrors) residModXLG4_4 sambeg samend residModXLG4_5 coefModXLG4_5
# constant TR10Y{1}
compute alpha5 = %beta(1), beta5 = %beta(2)
dis 'alpha5= ' alpha5 'beta5= ' beta5
linreg(robusterrors) residModXLG4_5 sambeg samend residModXLG4_6 coefModXLG4_6
# constant YOY%_HPI{1}
compute alpha6 = %beta(1), beta6 = %beta(2)
dis 'alpha6= ' alpha6 'beta6= ' beta6
linreg(robusterrors) residModXLG4_6 sambeg samend residModXLG4_7 coefModXLG4_7
# constant TR3M
compute alpha7 = %beta(1), beta7 = %beta(2)
dis 'alpha7= ' alpha7 'beta7= ' beta7
linreg(robusterrors) residModXLG4_7 sambeg samend residModXLG4_8 coefModXLG4_8
# constant YOY%_CRE
compute alpha8 = %beta(1), beta8 = %beta(2)
dis 'alpha8= ' alpha8 'beta8= ' beta8
linreg(robusterrors) residModXLG4_8 sambeg samend residModXLG4_9 coefModXLG4_9
# constant UR
compute alpha9 = %beta(1), beta9 = %beta(2)
dis 'alpha9 = ' alpha9 'beta9 = ' beta9
But how how to restrict,say, constant to be positive and fall between 5 and 10.
Thank you very much.
Yelena