Here's a simple set of commands (assumes N large):
xtset id year
reg D.(y x1 ... xK year2 .. yearT), nocons vce(cluster id)
predict ehat, resid
reg ehat L.ehat, vce(cluster id)
lincom 1 2*L1.ehat
The coef in lincom is the AR(1) param estimate. The CI is valid for all rho.
In Stata this would be
* set the panel
xtset species year
* run the model
xtreg biomass i.year bodysize region othercovariates, fe
You want the interactions for year (this is the i.year) and to use fixed effects. Should be easy to translate to R.
Face masks are here to stay for the foreseeable future, so we’re giving away a trio of our brand new Stata face masks to a lucky winner this month. Comment below with your 1 favorite Stata command and you’ll be entered to win, simple as that! Winner will announced on Wed 16 Sep.
xtset id time
sort id time
egen treat_onset = min(cond(treat==1, time, .)), by(id)
BOOM you have a variable with those dates you forgot.
There might be a better way, but I wish I knew this sooner.
Untuk diperhatikan kepada adik-adik yang tahun depan skrispi:
Klo main data panel jangan sampe kebalik ya xtset-nya nanti kayak gue yang harusnya observasi 299 kota, jadi observasi sejumlah n waktu, dan t-nya 299 tahun. Kalau dihitung-hitung kayaknya dari 1771 VOC aja blm bubar