Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to store and retrieve tstat, rsqr, and percentilies from looped regressions

    I have a project that requires generating 100 random variable of 'e' and 'a', then simulating a random walk of e and a, where e->yt and a->xt. Next I have to regress yt on xt. this process is to repeated 1000 times. I have this much covered in the following code, but i need to retrieve the r-sqr, tstat, and 5 and 95 percentile values from each regression. How do I retrieve these values? Here is my code: (also, I have to drop variable within the loop because the student edition of stat restricts my variable count.)
    set obs 100
    forvalues i=1(1)1000 {
    gen e`i'=rnormal()
    gen a`i'=rnormal()
    gen yt`i'=e`i'+sum(e`i'[_n-1])
    gen xt`i'=a`i'+sum(a`i'[_n-1])
    drop e`i'
    drop a`i'
    gen reg`i'=reg yt`i' xt`i'
    }
Working...
X