Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: rolling regression and hypothesis testing |

Date |
Wed, 6 Apr 2011 00:47:42 +0100 |

This is a long way from a program that will work with -rolling-. As the help for -rolling- explains, it picks up results from a called program. Those results can take various forms, but results put in variables are not among them. More positively, Kit Baum replied to this thread earlier indicating a likely program that he has written. Why don't you start with that, at least as a template? Nick On Tue, Apr 5, 2011 at 9:01 PM, Nat Tharnpanich <nt289@cam.ac.uk> wrote: > I have been trying to write the program that -rolling- can call in order to > do regression and hypothesis testing in one go. However, I am having a > problem in the hypothesis testing part as I want to test the significance of > the difference between an estimated coefficient and a variable, say, Z which > takes on a value that differs by year. So I have rolling windows(20) clear, > progname and the program is as follows, program progname > reg Yt X1t X2t > test X1t = Zt > gen p = r(p) // to generate a variable for p values > gen f = r(F) // to generate a variable for F statistics > end and t is year. If Zt is a constant, then presumably my program would > work fine. However, since the value of Zt varies from from year to year, > Stata interprets Zt as one of the regressors which is always not found > because -rolling- command will not keep Zt when it is executed. I have spent > all day and night to figure out how to write the correct code, but still > completely clueless. I would greatly appreciate any advice on this. Thank > you very much. Nat > > On Apr 4 2011, Nick Cox wrote: > >> There is no contradiction here, as you can write a program that does your >> regression and testing and then that can be the single command that >> -rolling- calls. >> >> However, a big, big, big caveat is that these tests are manifestly not >> independent, so goodness know how you interpret them. >> >> Nick n.j.cox@durham.ac.uk >> Nat Tharnpanich >> >> I would like to run rolling OLS regression of, say, overlapping 20-year >> periods and test a hypothesis whether the coefficient is statistically >> different from 1. As far as I know, the rolling command in Stata allows you >> to execute only one command at a time. But in my case, I want to run a >> regression of each subperiod and then test the hypothesis for that subperiod >> before Stata goes on to subsequent subperiods and this involves two >> commands, reg and test. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: rolling regression and hypothesis testing***From:*Nat Tharnpanich <nt289@cam.ac.uk>

**st: RE: rolling regression and hypothesis testing***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: rolling regression and hypothesis testing***From:*Nat Tharnpanich <nt289@cam.ac.uk>

- Prev by Date:
**Re: st: PCA with unbalanced data** - Next by Date:
**Re: st: egen rowmean, loops and if** - Previous by thread:
**Re: st: RE: rolling regression and hypothesis testing** - Next by thread:
**st: F test on VECM** - Index(es):