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]
Re: st: Regression discontinuity with interrupted time series
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: Regression discontinuity with interrupted time series
Date
Thu, 7 Mar 2013 17:09:51 -0500
Joshua Mitts <[email protected]>:
I suggest you design a simulation that matches your data and your
hypothesized effects, then see what seems to work well. Below is a
quick foray along lines that I gather match your setting
approximately, where OLS seems to win on MSE grounds but over-rejects
a true null badly, and the higher MSE of my proposed long differences
seems outweighed by a good pattern of mean estimated coefs and
rejection rates. But YMMV.
clear all
ssc inst rd, replace
prog rdits, rclass
syntax [, n(int 1000) c(real .5) f(real .5)]
matrix C = (1, .5 \ .5, 1)
drawnorm x u, corr(C) n(`n') clear
drawnorm e z
g int i=_n
expand 20
* serial correlation in e and x governed by `c'
bys i:replace e=e[_n-1]*`c'+rnormal()*(1-`c') if _n>1
by i:replace x=x[_n-1]*`c'+1+rnormal()*(1-`c') if _n>1
replace x=exp(x)
by i:g byte t=_n
g A=(z>0)
* A increases p(T) but T and x linked
g T=(t>6)*(uniform()<(A*(`f'))+normal(ln(x))/2)
* y increases linearly in t, x
g y=t/2+x/10+z/10-z^2/10+T/2+T*(t-6)/4+e
* but we don't observe x, u
g Tt=T*t
g At=A*t
reg y T t Tt, cl(i)
return scalar tols=_b[t]
return scalar setols=_se[t]
return scalar tTols=_b[Tt]
return scalar setTols=_se[Tt]
ivreg y t (T Tt=A At), cl(i)
return scalar tiv=_b[t]
return scalar setiv=_se[t]
return scalar tTiv=_b[Tt]
return scalar setTiv=_se[Tt]
g k=max(0,1.5-abs(z))
ivreg y t (T Tt=A At) [aw=k], cl(i)
return scalar trd=_b[t]
return scalar setrd=_se[t]
return scalar tTrd=_b[Tt]
return scalar setTrd=_se[Tt]
tsset i t
forv i=1/12 {
g dy`i'=y-L`i'.y if t==6+`i'
rd dy`i' T z, mbw(100)
return scalar t`i'=_b[lwald]
return scalar set`i'=_se[lwald]
}
eret clear
end
simul, r(1000):rdits
tw kdensity tols||kdensity tiv||kdensity trd, name(main)
tw kdensity tTols||kdensity tTiv||kdensity tTrd, name(interact)
foreach v in ols iv rd {
g mse_t`v'=(t`v'-.5)^2
g mse_tT`v'=(tT`v'-.25)^2
}
forv v=1/12 {
g mse_t`v'=(t`v'-.5-.25*`v')^2
}
foreach v in ols iv rd {
g rej_t`v'=abs((t`v'-.5)/set`v')>abs(invnormal(.05))
g rej_tT`v'=abs((tT`v'-.25)/setT`v')>abs(invnormal(.05))
}
forv v=1/12 {
g rej_t`v'=abs((t`v'-.5-.25*`v')/set`v')>abs(invnormal(.05))
}
su rej*, sep(6)
su mse*, sep(6)
g i=_n
reshape long t, i(i) j(time)
egen mt=mean(t), by(time)
sc t mt time, msize(tiny)||function .5+x/4, ra(0 10)
On Thu, Mar 7, 2013 at 4:00 PM, Joshua Mitts <[email protected]> wrote:
> Hi all,
>
> Thank you all so much for the responses. Austin, your comments were
> very helpful and I greatly appreciate it.
*
* 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/