I'm doing my first simulation study, and I'd like to see how sensitive my estimator is to various levels of Gaussian noise. To do so, I'd like to get all of the pre-post Mean Squared Errors in a matrix. My question is, how may I loop over (or a user written command) multiple matrices and append them to one another? The code below does exactly as I wish...
However, what if I had 20 levels of noise? What if I simulated it from 0.01 to 1, increasing it by 0.001 each time? Clearly, it doesn't make sense to keep doing
until I'm at err_1000. How might I append all of these together at once, where "Noise of 1" comes first all the way to "Noise of `n'"?
Code:
sysuse auto, clear matrix drop _all loc list weight mpg trunk headroom gear foreign turn loc n: word count `list' cls qui forv i = 1/`n' { loc a: word `i' of `list' reg price `a' tempname err_`i' matrix `err_`i'' = e(rmse) , e(r2) matrix rownames `err_`i'' = "Noise of `i'" matrix colnames `err_`i'' = "RMSE" "R2" } mat A = (`err_1' \\`err_2' \\`err_3') mat l A
Code:
mat A = (`err_1' \\`err_2' \\`err_3') // ............ and so on
Comment