Announcement

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

  • Rolling regression with pooled time series data; plotting 10 year windows with 95% CI

    Hi everyone,

    I basically want to replicate figure four in Pontusson and Kwon (2010) with different data or, I guess, create the graph in 16:10 https://www.youtube.com/watch?v=RyqTeDxklfk (Stata Time Series Tutorial: The Rolling Regression). The plan is to use a rolling regression with 10-year windows and Prais-Winsten estimates; panel corrected errors and first order autoregressive corrections.

    My variables are: id, idn, year (time), uegen (my dependent variable), leftcum (my independent variable), and controls. id=countries (Austria, Denmark, Sweden etc.), year=from 1960 to 2019 (although missing data roughly before and after 1980 and 2011 respectively), uegen=index of unemployment benefits, leftcum=cummulative years of left government rule (so restarting for each country and rising over consecutive years). Unfortunately, It's not my data so won't be able to share it.

    I've so far identified the commands: "rolling _b _se, window(10): prais uegen leftcum", generate upper = _b_leftcum_ + 1.96*_se_leftcum, and generate lower = _b_ leftcum - 1.96*se_leftcum. However, I'm not able to plot the figure. Using "two-way (line_b_leftcum) (line upper lower)" from https://www.stata.com/manuals13/tsrolling.pdf (Rolling - Stata) gives the error message "too few variables specified". I don't know how to specify years as the time variable because "tsset" doesn't seem to apply to pooled time series data "repeated time values in sample".

    Summary: I'd like to plot 10 year windows of Prais-Winsten estimates with 95% confidence intervals but can't figure out how to create the figure.
    Last edited by Petter Rodebjer; 21 Jan 2022, 15:43.

  • #2
    There is a two-part solution to this issue: (1) create a new time-variable, identical to "year" with "gen YEAR year" (so I kinda didn't read the manual close enough after all). Rolling, then, automatically generates an additional variable "date" that is identical to YEAR (and year). (2) Set the time component to: "tsset idn date" and plot your figures.

    My supervisor told me to use "tsset unit time" (in my case "tsset idn year) in (another) failed attempt to merge two pooled time series data sets. Apparently, time series data only require you to specify time, "tsset time", while pooled time series data require you to specify the unit as well, "tsset unit time".
    Last edited by Petter Rodebjer; 21 Jan 2022, 16:54. Reason: Poor writing.

    Comment

    Working...
    X