Hi there,
I am using a two-way fixed effects model that I would like to use to forecast and simulate alternative scenarios based on the Stata command "forecast". The challenge here is how to use the command forecast with two dimensional FE. The stata manual explains quite well how to use the command forecast in a panel with one FE, but not if you want to consider region and time fe.
My data is strongly balanced with T=572 and N=324. Now I can either use xtreg, fe or reghdfe, but both alternatives lead to different error messages.
1. use of reghdfe
xtset county week, weekly
reghdfe y L1.y x_1 x_2 , vce(cluster Landkreis) absorb(i.week i.county) resid(r)
estimates store est_1
predict FE if age_group==`susc',d
bysort Landkreis: egen FE_2=mean(FE)
forecast create est_1, replace
* adjust for FE
forecast estimates est_1, name(est_1, replace)
forecast adjust est_1=est_1+ FE_2
* declare non-stochastic relationships
forecast identities
forecast exogenous
forecast solve, begin(tw(2011w28)) log(off) prefix(alt2_) simulate(betas errors, statistic(stddev, prefix(sd_alt2_)) reps(500))
=> I obtain the follwoing error message: "command may not be used with panel data"
2. use of xtreg
xtset county week, weekly
xtreg y L1.y x_1 x_2 i.week , vce(cluster Landkreis) fe
estimates store est_1
predict FE if age_group==`susc', u
bysort Landkreis: egen FE_2=mean(FE)
forecast create est_1, replace
* adjust for FE
forecast estimates est_1, name(est_1, replace)
forecast adjust est_1=est_1+ FE_2
* declare non-stochastic relationships
forecast identities
forecast exogenous
forecast solve, begin(tw(2011w28)) log(off) prefix(alt2_) simulate(betas errors, statistic(stddev, prefix(sd_alt2_)) reps(500))
=> I obtain the following error message "cannot simulate parameter vector
Stored estimation result I_a5 contains a parameter covariance matrix that is not full rank, so forecast cannot draw multivariate normal parameters."
Any advise is highly welcome!
Related Posts with xtreg/reghdfe + dynamic forecasting
graph with range in x axisDear All, Suppose that I have this code Code: sysuse auto, clear twoway (scatter mpg weight if weig…
Moving vertical axis in graph hbarHi, I'm trying to plot a variable called "teleworking rate" by region. So my data looks like: tw_r…
How to create new variables using observations from other variable but observations contain spaces?I tried to use the following command to create new variables using observations from a variable "ind…
Fuzzy matching: choosing potential matches (reclink/matchit)Does anyone know how reclink chooses which potential matches to report? Does it effectively sort the…
Reduced sample size in time trends analysisHi, I have an indicator variable EventIndicator, which takes the value 1 if a firm is headquartered …
Subscribe to:
Post Comments (Atom)
0 Response to xtreg/reghdfe + dynamic forecasting
Post a Comment