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 |
Nat Tharnpanich <nt289@cam.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
06 Apr 2011 13:45:36 +0100 |

Dear Kit,

<> This should come close. Haven't had my morning caffeine fix yet, so itmay need a little work. But I think the concept does what you need.----------------------- prog drop _all prog testroll, rclass reg investment income consumption scalar lnow = linvestment[$inow] global inow = $inow + 1 test income = lnow ret sca f = r(F) ret sca p = r(p) ret sca inow = $inow ret sca lnow = lnow end webuse lutkepohl,clear global inow 20 testroll ret li global inow 20 rolling f=r(f) p=r(p) inow=r(inow) lnow=r(lnow) in 21/l, w(12): testroll ------------------------- Kit On Apr 6, 2011, at 2:33 AM, Nat wrote:I have been trying to write the program that -rolling- can call inorder to do regression and hypothesis testing in one go. However, I amhaving a problem in the hypothesis testing part as I want to test thesignificance of the difference between an estimated coefficient and avariable, say, Z which takes on a value that differs by year. So I haverolling windows(20) clear, progname and the program is as follows,program prognamereg 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.Kit Baum | Boston College Economics & DIW Berlin |http://ideas.repec.org/e/pba1.htmlAn Introduction to Stata Programming |http://www.stata-press.com/books/isp.htmlAn Introduction to Modern Econometrics Using Stata |http://www.stata-press.com/books/imeus.html* * 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/

-- Nat Tharnpanich Downing College and Department of Land Economy University of Cambridge CB2 1DQ nt289@cam.ac.uk * * 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**:**Re: Re: st: RE: rolling regression and hypothesis testing***From:*Christopher Baum <kit.baum@bc.edu>

- Prev by Date:
**st: How do I estimate multinomial logit using glm?** - Next by Date:
**Re: st: How do I estimate multinomial logit using glm?** - Previous by thread:
**Re: Re: st: RE: rolling regression and hypothesis testing** - Next by thread:
**st: xtregar, fe lbi** - Index(es):