Skip to main content

Time Series Analysis

  • Chapter
  • First Online:
Political Analysis Using R

Part of the book series: Use R! ((USE R))

  • 12k Accesses

Abstract

Most of the methods described so far in this book are oriented primarily at cross-sectional analysis, or the study of a sample of data taken at the same point in time. In this chapter, we turn to methods for modeling a time series, or a variable that is observed sequentially at regular intervals over time (e.g., daily, weekly, monthly, quarterly, or annually). Time series data frequently have trends and complex error processes, so failing to account for these features can produce spurious results (Granger and Newbold 1974). Several approaches for time series analysis have emerged to address these problems and prevent false inferences. Within Political Science, scholars of public opinion, political economy, international conflict, and several other subjects regularly work with time-referenced data, so adequate tools for time series analysis are important in political analysis.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Many use ARIMA models for forecasting future values of a series. ARIMA models themselves are atheoretical, but often can be effective for prediction. Since most Political Science work involves testing theoretically motivated hypotheses, this section focuses more on the role ARIMA models can serve to set up inferential models.

  2. 2.

    If you do not have the data file PESenergy.csv already, you can download it from the Dataverse (see page vii) or the online chapter content (see page 155).

  3. 3.

    In addition to examining the original series or the autocorrelation function, an Augmented Dickey–Fuller test also serves to diagnose whether a time series has a unit root. By loading the tseries package, the command adf.test will conduct this test in R.

  4. 4.

    The primary noticeable change is that the default version of acf graphs the zero-lag correlation, ACF(0), which is always 1.0. The TSA version eliminates this and starts with the first lag autocorrelation, ACF(1).

  5. 5.

    The formula for these error bands is: 0 ± 1. 96 × se r . The standard error for a correlation coefficient is: \(se_{r} = \sqrt{\frac{1-r^{2 } } {n-2}}\). So in this case, we set r = 0 under the null hypothesis, and n is the sample size (or series length).

  6. 6.

    Technically, PACF at the third lag is negative and significant, but the common patterns of error processes suggest that this is unlikely to be a critical part of the ARIMA process.

  7. 7.

    Here we show in the main text how to gather one diagnostic at a time, but the reader also may want to try typing tsdiag(ar1.mod,24) to gather graphical representations of a few diagnostics all at once.

  8. 8.

    In this case, we have a pulse input, so we can say that in November 1973, the effect of the speech was an expected 161 increase in news stories, holding all else equal. In December 1973, the carryover effect is that we expect 98 more stories, holding all else equal because 161 × 0. 61 ≈ 98. In January 1974, the effect of the intervention is we expect 60 more stories, ceteris paribus because 161 × 0. 61 × 0. 61 ≈ 60. The effect of the intervention continues forward in a similar decaying pattern. By contrast, if we had gotten these results with a step intervention instead of a pulse intervention, then these effects would accumulate rather than decay. Under this hypothetical, the effects would be 161 in November 1973, 259 in December 1973 (because 161+98=259), and 319 in January 1974 (because 161+98+60=319).

  9. 9.

    In particular, at each stage of the iterative process, the linear model is estimated by regressing \(y_{t}^{{\ast}} = y_{t} -\rho y_{t-1}\) on \(\mathbf{x}_{t}^{{\ast}} = \mathbf{x}_{t} -\rho \mathbf{x}_{t-1}\) (Hamilton 1994, p. 223). This procedure assumes that the dynamic adjustment process is the same for the outcome and the input variables, which is unlikely. Hence, a dynamic specification such as an autoregressive distributive lag model would be more flexible.

  10. 10.

    This example requires the file levant.dta. Please download this file from the Dataverse (see page vii) or this chapter’s online content (see page 155).

  11. 11.

    You are encouraged to examine the models that would have been chosen by the Hannan–Quinn criterion (4 lags) or the Schwarz criterion (1 lag) on your own. How do these models perform in terms of diagnostics? How would inferences change?

  12. 12.

    Note that, by default, the graph R presents actually includes the zero-lag perfect correlation. If you would like to eliminate that, given our long lag length and the size of the panel, simply load the TSA package before drawing the graph to change the default.

  13. 13.

    Beware that bootstrap-based confidence intervals do not always give the correct coverages because they confound information about how well the model fits with uncertainty of parameters. For this reason, Bayesian approaches are often the best way to represent uncertainty (Brandt and Freeman 2006; Sims and Zha 1999).

  14. 14.

    My thanks to Dave Armstrong for writing and suggesting this alternative code.

References

  • Box GEP, Tiao GC (1975) Intervention analysis with applications to economic and environmental problems. J Am Stat Assoc 70:70–79

    Article  MathSciNet  MATH  Google Scholar 

  • Box GEP, Jenkins GM, Reinsel GC (2008) Time series analysis: forecasting and control, 4th edn. Wiley, Hoboken, NJ

    Book  MATH  Google Scholar 

  • Box-Steffensmeier JM, Freeman JR, Hitt MP, Pevehouse JCW (2014) Time series analysis for the social sciences. Cambridge University Press, New York

    Book  Google Scholar 

  • Brandt PT, Freeman JR (2006) Advances in Bayesian time series modeling and the study of politics: theory testing, forecasting, and policy analysis. Polit Anal 14(1):1–36

    Article  Google Scholar 

  • Brandt PT, Williams JT (2001) A linear Poisson autoregressive model: the Poisson AR(p) model. Polit Anal 9(2):164–184

    Article  Google Scholar 

  • Brandt PT, Williams JT (2007) Multiple time series models. Sage, Thousand Oaks, CA

    Google Scholar 

  • Cowpertwait PSP, Metcalfe AV (2009) Introductory time series with R. Springer, New York

    MATH  Google Scholar 

  • Cryer JD, Chan K-S (2008) Time series analysis with applications in R, 2nd edn. Springer, New York

    Book  MATH  Google Scholar 

  • Enders W (2009) Applied econometric time series, 3rd edn. Wiley, New York

    Google Scholar 

  • Fogarty BJ, Monogan JE III (2014) Modeling time-series count data: the unique challenges facing political communication studies. Soc Sci Res 45:73–88

    Article  Google Scholar 

  • Granger CWJ (1969) Investigating causal relations by econometric models and cross spectral methods. Econometrica 37:424–438

    Article  Google Scholar 

  • Granger CWJ, Newbold P (1974) Spurious regressions in econometrics. J Econ 26:1045–1066

    MATH  Google Scholar 

  • Hamilton JD (1994) Time series analysis. Princeton University Press, Princeton, NJ

    MATH  Google Scholar 

  • Keele L, Kelly NJ (2006) Dynamic models for dynamic theories: the ins and outs of lagged dependent variables. Polit Anal 14(2):186–205

    Article  Google Scholar 

  • Koyck LM (1954) Distributed lags and investment analysis. North-Holland, Amsterdam

    Google Scholar 

  • Lütkepohl H (2005) New introduction to multiple time series analysis. Springer, New York

    Book  MATH  Google Scholar 

  • Mátyás L, Sevestre P (eds) (2008) The econometrics of panel data: fundamentals and recent developments in theory and practice, 3rd edn. Springer, New York

    MATH  Google Scholar 

  • Peake JS, Eshbaugh-Soha M (2008) The agenda-setting impact of major presidential TV addresses. Polit Commun 25:113–137

    Article  Google Scholar 

  • Petris G, Petrone S, Campagnoli P (2009) Dynamic linear models with R. Springer, New York

    Book  MATH  Google Scholar 

  • Pfaff B (2008) Analysis of Integrated and cointegrated time series with R, 2nd edn. Springer, New York

    Book  MATH  Google Scholar 

  • Shumway RH, Stoffer DS (2006) Time series analysis and its applications with R examples, 2nd edn. Springer, New York

    MATH  Google Scholar 

  • Sims CA, Zha T (1999) Error bands for impulse responses. Econometrica 67(5):1113–1155

    Article  MathSciNet  MATH  Google Scholar 

  • Wakiyama T, Zusman E, Monogan JE III (2014) Can a low-carbon-energy transition be sustained in post-Fukushima Japan? Assessing the varying impacts of exogenous shocks. Energy Policy 73:654–666

    Article  Google Scholar 

  • Wei WWS (2006) Time series analysis: univariate and multivariate methods, 2nd edn. Pearson, New York

    MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

9.1 Electronic Supplementary material

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this chapter

Cite this chapter

Monogan, J.E. (2015). Time Series Analysis. In: Political Analysis Using R. Use R!. Springer, Cham. https://doi.org/10.1007/978-3-319-23446-5_9

Download citation

Publish with us

Policies and ethics