Could you tell me why I cannot save my y or residuals here? Everything working except last and I dont know how to store y.
In addition the looping over values is not performing, it only does the 10 obs specified in local mc = 10.
Thanks much!
clear local mc = 10
set obs `mc'
g data_store_x3 =.
g data_store_x2 =.
g data_store_con= .
g data_store_y =.
quietly{
forvalues i = 1(1) `mc' {
if floor((`i'-1)/100) == ((`i'-1)/100) {
noisily display "Working on `i' out of `mc' at $S_TIME"
}
preserve
clear
set obs 10
g x2 = rnormal()
g x3 = rnormal()
g e = runiform()
g y = 1 -3*x2 + 2*x3 + e
reg y x2 x3
local x2coeff = _b[x2]
local x3coeff = _b[x3]
local const = _b[_cons]
restore
replace data_store_x3 = `x3coeff' in `i'
replace data_store_x2 = `x2coeff' in `i'
replace data_store_con = `const' in `i'
}
}
summ data_store_con data_store_x2 data_store_x3 data_store_y
display e(rmse)
predict res, resid
Comment