Code:
rbd agno promedio 1 2014 205.9502 1 2015 191.57983 1 2016 194.0618 1 2017 202.0082 1 2018 205 4 2014 263.53513 4 2015 279.52362 4 2016 270.3875 4 2017 267.1192 4 2018 277.5 5 2014 288.3368 5 2015 268.91162 5 2016 257.3042 5 2017 291.87463 5 2018 269.5
Code:
reg promedio agno if rbd==1 mat beta=e(b) svmat double beta, names(matcol) gen aux=. sum betaagno if rbd==1 replace aux=r(mean) if rbd==1
Code:
rbd agno promedio betaagno beta_cons aux 1 2014 205.9502 .8527954 -1519 .8527954 1 2015 191.57983 . .8527954 1 2016 194.0618 . .8527954 1 2017 202.0082 . .8527954 1 2018 205 . .8527954 4 2014 263.53513 . . . 4 2015 279.52362 . . . 4 2016 270.3875 . . . 4 2017 267.1192 . . . 4 2018 277.5 . . . 5 2014 288.3368 . . . 5 2015 268.91162 . . . 5 2016 257.3042 . . . 5 2017 291.87463 . . . 5 2018 269.5 . . .
Code:
forvalues i= 1/5 { cap reg promedio agno if rbd==`i' mat beta=e(b) svmat double beta, names(matcol) sum betaagno if rbd==`i' replace aux=r(mean) if rbd==`i' drop betaagno beta_cons }
2) I dont know how i can especify to the software that there are missing id values. (rbd 2, 3 are missing)
please help.
José Antonio
0 Response to Looping simple linear regression and storing beta coefficient
Post a Comment