Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: rollreg
From
Timothy King <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: rollreg
Date
Mon, 16 Dec 2013 17:17:07 +0000
Dear Statalist,
I am trying to run a rollreg example that performs a rolling regression for each company but get the error message:
'too few quotes'. I can't spot the source.
The code is as follows:
* rollreg by firm
set more off
webuse invest2, clear
tsset company time
rollreg market L(0/1).invest time, move(8) stub(mktM)
local dv `r(depvar)'
local rl `r(reglist)'
local stub `r(stub)'
local wantcoef invest
local m "`r(rolloption)’(`r(rollobs)’)"
forv i=1/4 {
qui reg `dv' `rl' if company==`i'
local cinv = _b[`wantcoef']
tsline `stub'_`wantcoef' if company==`i' & `stub'_`wantcoef'<., ///
ti("company `i'") yli(`cinv') yti("moving beta") ///
name(comp `i’,replace) nodraw
local all "`all' comp`i'"
}
graph combine `all’, ti("`m’ coefficient of `dv’ on `wantcoef’") ///
ysize(4) xsize(4) col(2) ///
t1("Full-sample coefficient displayed") saving("`wantcoef’.gph",replace)
Thank you in advance,
Tim
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/