 Applied Time Series Analysis

# Useful Stand-Alone R Programs for

Applied Time Series Analysis
Wayne A. Woodward, Southern Methodist University, Dallas, Texas, USA; Henry L. Gray, Southern Methodist University, Dallas, Texas, USA; Alan Elliott, University of Texas Southwestern Medical Center at Dallas, USA

In the following we discuss some useful stand-alone R programs that are provided on this website.  Most of the figures and examples in Chapters 1-11 involve capabilities of the GW-WINKS program.  The figures in these chapters were created by R, but in most cases the realizations, spectral estimates, autocorrelations, etc. were obtained using GW-WINKS.  Although GW-WINKS can create plots, for purposes of consistency we created all files using either R (or S+).   In the following we give examples of the R code that is used to create some of these plots.  In the R code, we assume that the data are read from and plots are written to the subdirectory c:\ATSA.

1.  Plotting figures such as Figure 1.18
Several figures throughout the book include a realization centered above a row containing plots of the autocorrelations and spectral quantities (either sample or true values).  See for example Figure 1.18.  R code used to create these plots can be found in Figure1.18.R .  Two R programs are provided,  one for the case in which the data are read from .txt files and one in which the data are in a .csv file (which can be created either from GW-WINKS or Excel).

2.  Plotting the periodogram.
Figure 1.16 shown below contains plots of the periodogram.  The R code for creating Figure 1.16 is given in in Figure1.16.R .

3.  Long memory model calculations
R programs for long memory models discussed in Chapter 11 are available at the following links:

1. Calculate true autocorrelations at trueacv.R
2. Generate realizations (both Fractional/FARMA and Gegenbauer/GARMA) at simulations.R
3. Estimate parameters at GARMA parm est.R
4. Calculate and plot forecasts at forecast and plot.R

4.  Wavelet analysis
We have used R and S+ to perform the wavelet analyses given in Chapter 12.  CRAN contains several wavelet packages.  We have used the functions available in Waveslim for several of the examples.  Also, we used the Wavelet module in S+.  The R and S+ code required to produce the wavelet-related results and figures in Chapter 12 are available at Chapter12.R

5.  Wigner-Ville plots and plots of the Gabor spectrum
Wigner-Ville plots, such as Figure 12.3(c) and (d),  of the time-varying frequency behavior were discussed in Chapter 12, and an R function for plotting a Wigner-Ville plot can be found at wvR.R.  Plots of the Gabor spectrum, such as Figure 12.3(a) and (b), were obtained in R using the function cgt in the package Rwave available in CRAN.  Code for obtaining Figure 12.3, and most of the figures in Chapter 12, are available at Chapter12.R

Back to main ATSA Page