I would like to regress each variable separately on one independent variable. Furthermore, the first regression for each variable should be based on the observations 1 up to lets say 10, the second regression for each variable on the observations 11 up to 20 and so on. In a final step I would like to have all the coefficients listed in a table.
This is the code I thought may work, but it gives the error massage " 'i' invalid obs no". Could anyone tell me where the mistake is?
Any help would be very much appreciated!
Code:
clear all set more off sysuse auto postutil clear postfile bse str20 var float (beta1) using results, replace foreach s of varlist mpg-trunk{ forvalues i= 1 (1)64{ quiet reg price `s' in ‘i’ / ‘i’ +10 } matrix r = r(table) post bse ("`s'") (r[1,2]) } postclose bse use results, clear list
0 Response to regression over different number of observations
Post a Comment