Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Estimating individual‐specific slopes with year fixed effects and AR(1) errors in Stata

    Hi all,

    I’m trying to replicate a series of regressions in which, for each forecaster i and forecast horizon h (t+1, t+2, t+5), I estimate an expectations‐augmented Phillips curve of the form
    E_{t,i}\bigl[\Delta\pi_{t+h}\bigr] = \alpha_i + \beta_i\,E_{t,i}\bigl[\Delta u_{t+h}\bigr] + \frac{1}{K}\sum_{k=1}^{K}\theta_k\,\mathrm{year}_k + \varepsilon_t, \varepsilon_t = \varphi\,\varepsilon_{t-1},
    • Et,i_t,i: survey‐round expectations
    • Δπ, Δu: expected inflation and unemployment changes
    • year_k: dummy =1 if the forecast target year = k (K=19 dummies)
    • AR(1) serial correlation in ε_t
    I need to run the model separately for each forecaster (i.e. get an individual slope β_i and its p‐value per person) and include year fixed effects (one dummy per target‐year, omitting a reference year) and correct the residuals for AR(1). Finally, I want to tabulate across all forecasters how many have β_i < 0 (consistent with theory) and how many are significant, etc.

    My questions:
    1. What is the best way in Stata to loop over each forecaster and horizon, estimate a separate regression with:
      • individual intercept α_i
      • individual slope β_i on Δu
      • time‐fixed effects
      • AR(1) errors ?
    2. Which command(s) should I use? I’ve seen prais, xtreg, reghdfe, etc. – which is most appropriate to get correct SEs under AR(1) and include year dummies?
    3. How do I extract and store each estimated β_i and its p‐value automatically (e.g. with postfile or statsby) so I can build the summary table?
    A minimal reproducible example of my data setup:
    * data: one obs per survey round * vars: forecaster_id target_period delta_pi delta_u
    Any code snippets or examples of a loop using foreach forecaster + the right estimation command would be greatly appreciated!

    Thanks in advance.
Working...
X