Package Astsa': R Topics Documented
Package Astsa': R Topics Documented
Package Astsa': R Topics Documented
September 2, 2021
Type Package
Title Applied Statistical Time Series Analysis
Version 1.14
Date 2021-08-31
Depends R (>= 3.5)
Author David Stoffer
Maintainer David Stoffer <stoffer@pitt.edu>
Description Data sets and scripts to accompany Time Series Analysis and Its Applica-
tions: With R Examples (4th ed), by R.H. Shumway and D.S. Stoffer. Springer Texts in Statis-
tics, 2017, <DOI:10.1007/978-3-319-52452-8>, and Time Series: A Data Analysis Ap-
proach Using R. Chapman-Hall, 2019, <DOI:10.1201/9780429273285>.
URL https://github.com/nickpoison/astsa/,
https://www.stat.pitt.edu/stoffer/tsa4/,
https://www.stat.pitt.edu/stoffer/tsda/
License GPL-3
LazyLoad yes
LazyData yes
NeedsCompilation no
Repository CRAN
Date/Publication 2021-09-02 14:50:49 UTC
R topics documented:
astsa-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
acf1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
acf2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
acfm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
ar1miss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
arf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
arma.spec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1
2 R topics documented:
ARMAtoAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
astsa.col . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
beamd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
birth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
blood . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
bnrf1ebv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
bnrf1hvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
cardox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
ccf2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
chicken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
climhyd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
cmort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
cpg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
djia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
dna2vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
EBV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
econ5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
EM0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
EM1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
EQ5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
EQcount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
eqexp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
EXP6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
FDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
flu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
fmri . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
fmri1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
gas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
gdp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
globtemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
globtempl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
gnp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
gtemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
gtemp2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
gtemp_land . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
gtemp_ocean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Hare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
HCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
hor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
jj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Kfilter0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Kfilter1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Kfilter2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Ksmooth0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Ksmooth1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Ksmooth2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
lag1.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
R topics documented: 3
lag2.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
LagReg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
lap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
lead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Lynx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
matrixpwr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
mvspec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
nyse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
oil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
PLT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
polio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
polyMul . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
prodn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
qinfl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
qintr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
rec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
sales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
salmon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
salt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
saltemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
sarima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
sarima.for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
sarima.sim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
scatter.hist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
SigExtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
so2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
soi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
soiltemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
sp500w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
spec.ic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
specenv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
speech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
ssm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
star . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
stoch.reg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
sunspotz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
SVfilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
tempr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
test.linear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
tsplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
unemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
UnempRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
varve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
WBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Index 97
4 acf1
astsa-package Applied Statistical Time Series Analysis (more than just data)
Description
Includes data and scripts to accompany Time Series Analysis and Its Applications: With R Examples
(4th ed) by R.H. Shumway and D.S. Stoffer, Springer Texts in Statistics, 2017 <DOI:10.1007/978-3-
319-52452-8> and Time Series: A Data Analysis Approach Using R, Chapman-Hall, 2019 <DOI:10.1201/9780429273285>.
Details
Package: astsa
Type: Package
Version: 1.14
Date: 2021-08-31
License: GPL-3
LazyLoad: yes
LazyData: yes
Author(s)
David Stoffer <stoffer@pitt.edu>
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Produces a plot (and a printout) of the sample ACF or PACF. The zero lag value of the ACF is
removed.
acf1 5
Usage
Arguments
Details
Will plot and print the sample ACF or PACF (if pacf=TRUE). The zero lag of the ACF (which is
always 1) has been removed. If plot=TRUE, a graph is produced and the values are rounded and
listed. If FALSE, no graph is produced and the values are listed
√ but not rounded by the script. The
error bounds are approximate white noise bounds, −1/n ± 2/ n; no other option is given.
Value
Author(s)
D.S. Stoffer
References
Examples
acf1(rnorm(100))
acf1(sarima.sim(ar=.9), pacf=TRUE)
Description
Produces a simultaneous plot (and a printout) of the sample ACF and PACF on the same scale. The
zero lag value of the ACF is removed.
Usage
acf2(series, max.lag=NULL, plot=TRUE, main=NULL, ylim=NULL,
na.action = na.pass, ...)
Arguments
series The data. Does not have to be a time series object.
√
max.lag Maximum lag. Can be omitted. Defaults to n + 10 unless n < 60. If the series
is seasonal, this will be at least 4 seasons by default.
plot If TRUE (default), a graph is produced and the values are rounded and listed. If
FALSE, no graph is produced and the values are listed but not rounded by the
script.
main Title of graphic; defaults to name of series.
ylim Specify limits for the y-axis.
na.action How to handle missing data; default is na.pass
... Additional arguments passed to tsplot
Details
This is basically a wrapper√for acf() provided in tseries. The error bounds are approximate white
noise bounds, −1/n ± 2/ n; no other option is given.
Value
ACF The sample ACF
PACF The sample PACF
acfm 7
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
acf2(rnorm(100))
Description
Produces a grid of plots of the sample ACF (diagonal) and CCF (off-diagonal).
Usage
acfm(series, max.lag = NULL, na.action = na.pass, ylim = NULL,
acf.highlight = TRUE, ...)
Arguments
series Multiple time series (at least 2 columns of time series)
√
max.lag Maximum lag. Can be omitted. Defaults to n + 10 unless n < 60. If the series
is seasonal, this will be at least 4 seasons by default.
na.action How to handle missing data; default is na.pass
ylim Specify limits for the all correlation axes. If NULL (default) the values are a
little wider than the min and max of all values.
acf.highlight If TRUE (default), the diagonals (ACFs) are highlighted.
... Additional arguments passed to tsplot
8 ar1miss
Details
Produces a grid of plots of the sample ACF (diagonal) and CCF (off-diagonal). The plots in the grid
are estimates of corr{x(t+LAG), y(t)}. Thus x leads y if LAG is positive and x lags y if LAG is
negative.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
acfm(diff(log(econ5)))
Description
Data used in Chapter 6
Format
The format is: Time-Series [1:100] with NA for missing values.
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
arf 9
Description
1000 simulated observations from an ARFIMA(1, 1, 0) model with φ = .75 and d = .4.
Format
The format is: Time-Series [1:1000] from 1 to 1000: -0.0294 0.7487 -0.3386 -1.0332 -0.2627 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Gives the ARMA spectrum, tests for causality, invertibility, and common zeros.
Usage
arma.spec(ar = 0, ma = 0, var.noise = 1, n.freq = 500,
main='from specified model', frequency=1, ...)
Arguments
ar vector of AR parameters
ma vector of MA parameters
var.noise variance of the noise
n.freq number of frequencies
main title of graphic
frequency for seasonal models, adjusts the frequency scale
... additional arguments
10 ARMAtoAR
Details
The basic call is arma.spec(ar,ma) where ar and ma are vectors containing the model parameters.
Use log='y' if you want the plot on a log scale. If the model is not causal or invertible an error
message is given. If there are approximate common zeros, a spectrum will be displayed and a
warning will be given; e.g., arma.spec(ar= .9,ma= -.9) will yield a warning and the plot will be
the spectrum of white noise.
Value
freq frequencies - returned invisibly
spec spectral ordinates - returned invisibly
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
arma.spec(ar = c(1, -.9), ma = .8)
Description
Gives the π-weights in the invertible representation of an ARMA model.
Usage
ARMAtoAR(ar = 0, ma = 0, lag.max=20)
astsa.col 11
Arguments
ar vector of AR coefficients
ma vector of MA coefficients
lag.max number of pi-weights desired
Value
A vector of coefficients.
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
ARMAtoAR(ar=.9, ma=.5, 10)
Description
Modifies the opacity level of the astsa color palette.
Usage
astsa.col(col = 1, alpha = 1)
Arguments
col numerical vector representing colors (default is 1 or ’black’) - see Examples
alpha factor in [0,1] setting the opacity (default is 1)
Value
a color vector using the astsa color palette at the chosen transparency level
12 beamd
Note
The astsa color palette is attached when the package is attached. The colors follow the R pattern
of shades of: (1) black, (2) red, (3) green, (4) blue, (5) cyan, (6) magenta, (7) gold, (8) gray. The
opacity of these colors can be changed easily using this script. Values are recycled, e.g., col=9 is
the same as col=1.
The astsa palette was developed from two basic ideas. The first is the general idea that time series
should be plotted using dark colors. The second is personal in that we prefer to anchor plots with
the best blue, dodgerblue3. From there, we used the website https://www.color-hex.com/ to
pick colors of type 2 to 7 that complement dodgerblue3.
Author(s)
D.S.Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
# View the astsa palette
par(mfrow=c(3,1))
barplot(rep(1,8), col=1:8, main='astsa palette', names=1:8)
barplot(rep(1,8), col=astsa.col(1:8, .7), main='transparency', names=1:8)
barplot(rep(1,8), col=astsa.col(3:6, .5), main='pastelity', names=rep(3:6, 2))
Description
Infrasonic signal from a nuclear explosion.
Usage
data(beamd)
birth 13
Format
A data frame with 2048 observations (rows) on 3 numeric variables (columns): sensor1, sensor2,
sensor3.
Details
This is a data frame consisting of three columns (that are not time series objects). The data are an
infrasonic signal from a nuclear explosion observed at sensors on a triangular array.
References
Description
Monthly live births (adjusted) in thousands for the United States, 1948-1979.
Format
The format is: Time-Series [1:373] from 1948 to 1979: 295 286 300 278 272 268 308 321 313 308
...
References
Description
Multiple time series of measurements made for 91 days on the three variables, log(white blood
count) [WBC], log(platelet) [PLT] and hematocrit [HCT]. Missing data code is NA.
Format
Details
This is the data set used in Chapter 6 with NA as the missing data code.
Source
Jones, R.H. (1984). Fitting multivariate models to unequally spaced data. In Time Series Analysis
of Irregularly Observed Data, pp. 158-188. E. Parzen, ed. Lecture Notes in Statistics, 25, New
York: Springer-Verlag.
References
See Also
Examples
Description
Nucleotide sequence of the BNRF1 gene of the Epstein-Barr virus (EBV): 1=A, 2=C, 3=G, 4=T.
The data are used in Chapter 7.
Format
The format is: Time-Series [1:3954] from 1 to 3954: 1 4 3 3 1 1 3 1 3 1 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Nucleotide sequence of the BNRF1 gene of the herpesvirus saimiri (HVS): 1=A, 2=C, 3=G, 4=T.
The data are used in Chapter 7.
Format
The format is: Time-Series [1:3741] from 1 to 3741: 1 4 3 2 4 4 3 4 4 4 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
16 ccf2
Description
Monthly mean carbon dioxide (in ppm) measured at Mauna Loa Observatory, Hawaii. This is an
update to co2 in the datasets package.
Format
The format is: Time-Series [1:729] from March, 1958 to November 2018: 315.71 317.45 317.50
317.10 ...
Details
The carbon dioxide data measured as the mole fraction in dry air, on Mauna Loa constitute the
longest record of direct measurements of CO2 in the atmosphere. They were started by C. David
Keeling of the Scripps Institution of Oceanography in March of 1958 at a facility of the National
Oceanic and Atmospheric Administration. NOAA started its own CO2 measurements in May of
1974, and they have run in parallel with those made by Scripps since then. Data are reported as a
dry mole fraction defined as the number of molecules of carbon dioxide divided by the number of
molecules of dry air multiplied by one million (ppm).
Source
https://gml.noaa.gov/ccgg/trends/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Produces a nice graphic of the sample CCF of two time series. The actual CCF values are returned
invisibly.
ccf2 17
Usage
ccf2(x, y, max.lag = NULL, main = NULL, ylab = "CCF", plot = TRUE,
na.action = na.pass, type = c("correlation", "covariance"), ...)
Arguments
x, y univariate time series
max.lag maximum lag for which to calculate the CCF
main plot title - if NULL, uses x and y names
ylab vertical axis label; default is ’CCF’
plot if TRUE (default) a graphic is produced and the values are returned invisibly.
Otherwise, the values are returned.
na.action how to handle missing values; default is na.pass
type default is cross-correlation; an option is cross-covariance
... additional arguments passed to tsplot
Details
This will produce a graphic of the sample corr[x(t+lag),y(t)] from -max.lag to max.lag.
Also, the (rounded) values of the CCF are returned invisibly unless plot=FALSE. Similar details
apply to the cross-covariance.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
ccf2(soi, rec, plot=FALSE) # now you see it
ccf2(soi, rec) # now you don't
Description
Poultry (chicken), Whole bird spot price, Georgia docks, US cents per pound
Usage
data("chicken")
Format
The format is: Time-Series [1:180] from August 2001 to July 2016: 65.6 66.5 65.7 64.3 63.2 ...
Source
https://www.indexmundi.com/commodities/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Lake Shasta inflow data. This is a data frame.
Format
A data frame with 454 observations (rows) on the following 6 numeric variables (columns): Temp,
DewPt, CldCvr, WndSpd, Precip, Inflow.
Details
The data are 454 months of measured values for the climatic variables: air temperature, dew point,
cloud cover, wind speed, precipitation, and inflow, at Lake Shasta, California. The man-made lake
is famous for the placard stating, "We don’t swim in your toilet, so don’t pee in our lake."
cmort 19
References
Description
Average weekly cardiovascular mortality in Los Angeles County; 508 six-day smoothed averages
obtained by filtering daily values over the 10 year period 1970-1979.
Format
The format is: Time-Series [1:508] from 1970 to 1980: 97.8 104.6 94.4 98 95.8 ...
References
See Also
lap
20 djia
Description
Median annual cost per gigabyte (GB) of storage.
Format
The format is: Time-Series [1:29] from 1980 to 2008: 213000.00 295000.00 260000.00 175000.00
160000.00 ...
Details
The median annual cost of hard drives used in computers. The data are retail prices per GB taken
from a sample of manufacturers.
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Daily DJIA values from April 2006 - April 2016
Format
The format is: xts [1:2518, 1:5] 11279 11343 11347 11337 11283 ...
- attr(*, "class")= chr [1:2] "xts" "zoo"
..$ : chr [1:5] "Open" "High" "Low" "Close" "Volume"
Source
The data were obtained as follows:
library(TTR) # install.packages('TTR') if you don't have it
djia = getYahooData("^DJI",start=20060420,end=20160420,freq="daily")
Unfortunately, this does not work now.
dna2vector 21
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Takes a DNA sequence (string) of general form (e.g., FASTA) and converts it to a sequence of
indicator vectors for use with the Spectral Envelope (specenv).
Usage
dna2vector(data, alphabet = NULL)
Arguments
data A DNA sequence as a single string.
alphabet The particular alphabet being used. The default is alphabet=c("A","C","G","T").
Details
Takes a string of categories and converts it to a matrix of indicators. The data can then be used by
the script specenv, which calculates the Spectral Envelope of the sequence (or subsequence). Many
different type of sequences can be used, including FASTA and GenBank, as long as the data is a
string of categories.
The indicator vectors (as a matrix) are returned invisibly in case the user forgets to put the results in
an object wherein the screen would scroll displaying the entire sequence. In other words, the user
should do something like xdata = dna2vector(data) where data is the original sequence.
As an example, if the DNA sequence is in a FASTA file, say sequence.fasta, remove the first line
which will look like >V01555.2 ... . Then the following code can be used to read the data into the
session, create the indicator sequence and save it as a compressed R data file:
Value
matrix of indicator vectors; returned invisibly
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
specenv
Examples
# Epstein-Barr virus (entire sequence included in astsa)
xdata = dna2vector(EBV)
Description
EBV nucleotide sequence - 172281 bp as a single string
econ5 23
Format
The format is: chr "AGAATTCGTCTT ..."
Note
EBV is not useful on its own, but using ‘dna2vector‘, different regions can be explored. For exam-
ple, ebv = dna2vector(EBV)
Source
https://www.ncbi.nlm.nih.gov/nuccore/V01555.2
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
dna2vector
Description
Multiple time series of quarterly U.S. unemployment, GNP, consumption, and government and
private investment, from 1948-III to 1988-II.
Usage
data(econ5)
Format
Multiple time series with 161 observations (rows) on the following 5 numeric variables (columns):
unemp, gnp, consum, govinv, prinv.
Source
Young, P.C. and Pedregal, D.J. (1999). Macro-economic relativity: government spending, private
investment and unemployment in the USA 1948-1998. Structural Change and Economic Dynamics,
10, 359-380.
24 EM0
References
Description
Usage
EM0(num, y, A, mu0, Sigma0, Phi, cQ, cR, max.iter = 50, tol = 0.01)
Arguments
Details
Value
Phi Estimate of Phi
Q Estimate of Q
R Estimate of R
mu0 Estimate of initial state mean
Sigma0 Estimate of initial state covariance matrix
like -log likelihood at each iteration
niter number of iterations to convergence
cvg relative tolerance at convergence
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Estimation of the parameters in the general state space model via the EM algorithm. Inputs are not
allowed; see the note.
Usage
EM1(num, y, A, mu0, Sigma0, Phi, cQ, cR, max.iter = 100, tol = 0.001)
Arguments
num number of observations
y observation vector or time series; use 0 for missing values
A observation matrices, an array with dim=c(q,p,n); use 0 for missing values
mu0 initial state mean
Sigma0 initial state covariance matrix
26 EM1
Details
cQ and cR are the Cholesky-type decompositions of Q and R. In particular, Q = t(cQ)%*%cQ and R =
t(cR)%*%cR is all that is required (assuming Q and R are valid covariance matrices).
Value
Phi Estimate of Phi
Q Estimate of Q
R Estimate of R
mu0 Estimate of initial state mean
Sigma0 Estimate of initial state covariance matrix
like -log likelihood at each iteration
niter number of iterations to convergence
cvg relative tolerance at convergence
Note
Inputs are not allowed (and hence not estimated). The script uses Ksmooth1 and everything related
to inputs are set equal to zero when it is called.
It would be relatively easy to include estimates of ’Ups’ and ’Gam’ because conditional on the
states, these are just regression coefficients. If you decide to alter EM1 to include estimates of the
’Ups’ or ’Gam’, feel free to notify me with a workable example and I’ll include it in the next update.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
EQ5 27
Description
Seismic trace of an earthquake [two phases or arrivals along the surface, the primary wave (t =
1, . . . , 1024) and the shear wave (t = 1025, . . . , 2048)] recorded at a seismic station.
Format
The format is: Time-Series [1:2048] from 1 to 2048: 0.01749 0.01139 0.01512 0.01477 0.00651 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
eqexp
EQcount EQ Counts
Description
Series of annual counts of major earthquakes (magnitude 7 and above) in the world between 1900
and 2006.
Format
The format is: Time-Series [1:107] from 1900 to 2006: 13 14 8 10 16 26 ...
Source
Zucchini and MacDonald (2009). Hidden Markov Models for Time Series: An Introduction using
R. CRC Press.
28 eqexp
References
Description
This is a data frame of the earthquake and explosion seismic series used throughout the text.
Format
A data frame with 2048 observations (rows) on 17 variables (columns). Each column is a numeric
vector.
Details
The matrix has 17 columns, the first eight are earthquakes, the second eight are explosions, and the
last column is the Novaya Zemlya event of unknown origin.
The column names are: EQ1,EQ2,...,EQ8; EX1,EX2,...,EX8; NZ. The first 1024 observations
correspond to the P wave, the second 1024 observations correspond to the S wave.
References
Description
Seismic trace of an explosion [two phases or arrivals along the surface, the primary wave (t =
1, . . . , 1024) and the shear wave (t = 1025, . . . , 2048)] recorded at a seismic station.
Format
The format is: Time-Series [1:2048] from 1 to 2048: -0.001837 -0.000554 -0.002284 -0.000303
-0.000721 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
eqexp
Description
Computes the basic false discovery rate given a vector of p-values.
Usage
FDR(pvals, qlevel = 0.05)
Arguments
pvals a vector of pvals on which to conduct the multiple testing
qlevel the proportion of false positives desired
Value
fdr.id NULL if no significant tests, or the index of the maximal p-value satisfying the
FDR condition.
30 flu
Source
https://www.stat.berkeley.edu/~paciorek/code/fdr/fdr.R
References
flu Monthly pneumonia and influenza deaths in the U.S., 1968 to 1978.
Description
Monthly pneumonia and influenza deaths per 10,000 people in the United States for 11 years, 1968
to 1978.
Usage
data(flu)
Format
The format is: Time-Series [1:132] from 1968 to 1979: 0.811 0.446 0.342 0.277 0.248 ...
References
Description
Data (as a vector list) from an fMRI experiment in pain, listed by location and stimulus. The data
are BOLD signals when a stimulus was applied for 32 seconds and then stopped for 32 seconds.
The signal period is 64 seconds and the sampling rate was one observation every 2 seconds for 256
seconds (n = 128). The number of subjects under each condition varies.
Details
The LOCATIONS of the brain where the signal was measured were [1] Cortex 1: Primary So-
matosensory, Contralateral, [2] Cortex 2: Primary Somatosensory, Ipsilateral, [3] Cortex 3: Sec-
ondary Somatosensory, Contralateral, [4] Cortex 4: Secondary Somatosensory, Ipsilateral, [5] Cau-
date, [6] Thalamus 1: Contralateral, [7] Thalamus 2: Ipsilateral, [8] Cerebellum 1: Contralateral
and [9] Cerebellum 2: Ipsilateral.
The TREATMENTS or stimuli (and number of subjects in each condition) are [1] Awake-Brush (5
subjects), [2] Awake-Heat (4 subjects), [3] Awake-Shock (5 subjects), [4] Low-Brush (3 subjects),
[5] Low-Heat (5 subjects), and [6] Low-Shock (4 subjects). Issue the command summary(fmri) for
further details. In particular, awake (Awake) or mildly anesthetized (Low) subjects were subjected
levels of periodic brushing (Brush), application of heat (Heat), and mild shock (Shock) effects.
As an example, fmri$L1T6 (Location 1, Treatment 6) will show the data for the four subjects
receiving the Low-Shock treatment at the Cortex 1 location; note that fmri[[6]] will display the
same data.
Source
Joseph F. Antognini, Michael H. Buonocore, Elizabeth A. Disbrow, Earl Carstens, Isoflurane anes-
thesia blunts cerebral responses to noxious and innocuous stimuli: a fMRI study, Life Sciences, Vol-
ume 61, Issue 24, 1997, Pages PL349-PL354, ISSN 0024-3205, https://doi.org/10.1016/S0024-3205(97)00960-0.
References
Description
A data frame that consists of average fMRI BOLD signals at eight locations.
Usage
data(fmri1)
Format
Details
Multiple time series consisting of fMRI BOLD signals at eight locations (in columns 2-9, column
1 is time period), when a stimulus was applied for 32 seconds and then stopped for 32 seconds.
The signal period is 64 seconds and the sampling rate was one observation every 2 seconds for 256
seconds (n = 128). The columns are labeled: "time" "cort1" "cort2" "cort3" "cort4" "thal1" "thal2"
"cere1" "cere2".
References
See Also
fmri
gas 33
Description
New York Harbor conventional regular gasoline weekly spot price FOB (in cents per gallon) from
2000 to mid-2010.
Format
The format is: Time-Series [1:545] from 2000 to 2010: 70.6 71 68.5 65.1 67.9 ...
Details
Pairs with series oil
Source
Data were obtained from the URL: www.eia.doe.gov/dnav/pet/pet_pri_spt_s1_w.htm
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
oil
Description
Seasonally adjusted quarterly U.S. GDP from 1947(1) to 2018(3).
Format
The format is: Time-Series [1:287] from 1947 to 2018: 2033 2028 2023 2055 2086 ...
34 globtemp
Source
https://tradingeconomics.com/united-states/gdp
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Global mean land-ocean temperature deviations (from 1951-1980 average), measured in degrees
centigrade, for the years 1880-2015. This was an update of gtemp, but gtemp_land and gtemp_ocean
are the most recent updates.
Format
The format is: Time-Series [1:136] from 1880 to 2015: -0.2 -0.11 -0.1 -0.2 -0.28 -0.31 -0.3 -0.33
-0.2 -0.11 ...
Details
The data were changed after 2011, so there are discrepancies between this data set and gtemp. The
differences are explained in the following document: www1.ncdc.noaa.gov/pub/data/ghcn/v3/GHCNM-
v3.2.0-FAQ.pdf.
Source
https://data.giss.nasa.gov/gistemp/graphs/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
globtempl 35
See Also
gtemp_land, gtemp_ocean, globtempl, gtemp, gtemp2
Description
Global mean [land only] temperature deviations (from 1951-1980 average), measured in degrees
centigrade, for the years 1880-2015. This is an update of gtemp2. Note the data file is globtemp-el
not globtemp-one; the el stands for land. The data files gtemp_land and gtemp_ocean are the most
recent updates.
Usage
data("globtempl")
Format
The format is: Time-Series [1:136] from 1880 to 2015: -0.53 -0.51 -0.41 -0.43 -0.72 -0.56 -0.7
-0.74 -0.53 -0.25 ...
Details
The data were changed after 2011, so there are discrepancies between this data set and gtemp2. The
differences are explained in the following document: www1.ncdc.noaa.gov/pub/data/ghcn/v3/GHCNM-
v3.2.0-FAQ.pdf.
Source
https://data.giss.nasa.gov/gistemp/graphs/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
gtemp_land, gtemp_ocean, globtemp, gtemp2, gtemp
36 Grid
Description
Format
The format is: Time-Series [1:223] from 1947 to 2002: 1489 1497 1500 1524 1547 ...
Source
https://research.stlouisfed.org/
References
See Also
gdp
Description
Adds a grid to an existing plot with major and minor ticks. Works like R graphics grid() but the grid
lines are are solid and gray and minor ticks are produced by default.
Usage
Grid(nx = NULL, ny = nx, col = gray(0.9), lty = 1, lwd = par("lwd"), equilogs = TRUE,
minor = TRUE, nxm = 2, nym = 2, tick.ratio = 0.5, xm.grid = TRUE, ym.grid = TRUE, ...)
Grid 37
Arguments
nx, ny number of cells of the grid in x and y direction. When NULL, as per default, the
grid aligns with the tick marks on the corresponding default axis (i.e., tickmarks
as computed by axTicks). When NA, no grid lines are drawn in the correspond-
ing direction.
col color of the grid lines.
lty line type of the grid lines.
lwd line width of the grid lines.
equilogs logical, only used when log coordinates and alignment with the axis tick marks
are active. Setting equilogs = FALSE in that case gives non equidistant tick
aligned grid lines.
minor logical with TRUE (default) adding minor ticks.
nxm, nym number of intervals in which to divide the area between major tick marks on the
x-axis (y-axis). If minor=TRUE, should be > 1 or no minor ticks will be drawn.
tick.ratio ratio of lengths of minor tick marks to major tick marks. The length of major
tick marks is retrieved from par("tck").
xm.grid, ym.grid
if TRUE (default), adds grid lines at minor x-axis, y-axis ticks.
... other graphical parameters;
Author(s)
D.S. Stoffer
Source
The code for grid() in R graphics and minor.tick() from the Hmisc package were combined.
References
See Also
grid
38 gtemp2
Description
This data file is old and is here only for compatibility. See globtemp and gtemp_land. The original
description is: Global mean land-ocean temperature deviations (from 1951-1980 average), mea-
sured in degrees centigrade, for the years 1880-2009.
Format
The format is: Time-Series [1:130] from 1880 to 2009: -0.28 -0.21 -0.26 -0.27 -0.32 -0.32 -0.29
-0.36 -0.27 -0.17 ...
Source
https://data.giss.nasa.gov/gistemp/graphs/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
gtemp_land, gtemp_ocean, globtemp, globtempl, gtemp2
Description
This data file is old and is here only for compatibility. See globtemp and gtemp_land. The original
description is: Similar to gtemp but the data are based only on surface air temperature data obtained
from meteorological stations. The data are temperature deviations (from 1951-1980 average), mea-
sured in degrees centigrade, for the years 1880-2009.
Usage
data(gtemp2)
gtemp_land 39
Format
The format is: Time-Series [1:130] from 1880 to 2009: -0.24 -0.19 -0.14 -0.19 -0.45 -0.32 -0.42
-0.54 -0.24 -0.05 ...
Source
https://data.giss.nasa.gov/gistemp/graphs/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
gtemp_land, gtemp_ocean, globtemp, globtempl, gtemp
Description
Annual temperature anomalies (in degress centigrade) averaged over the Earth’s land area from
1880 to 2017.
Format
The format is: Time-Series [1:138] from 1880 to 2017: -0.62 -0.45 -0.47 -0.62 -0.82 ...
Source
https://data.giss.nasa.gov/gistemp/graphs/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
40 Hare
See Also
gtemp_ocean, globtemp, globtempl, gtemp2
Description
Annual sea surface temperature anomalies averaged over the part of the ocean that is free of ice at
all times (open ocean) from 1880 to 2017.
Format
The format is: Time-Series [1:138] from 1880 to 2009: -0.05 0.01 0.00 -0.06 -0.15 ...
Source
https://data.giss.nasa.gov/gistemp/graphs/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
gtemp_land, globtemp, globtempl, gtemp2
Description
This is one of the classic studies of predator-prey interactions, the 90-year data set is the number, in
thousands, of snowshoe hare pelts purchased by the Hudson’s Bay Company of Canada. While this
is an indirect measure of predation, the assumption is that there is a direct relationship between the
number of pelts collected and the number of hare and lynx in the wild.
Usage
data("Hare")
HCT 41
Format
The format is: Time-Series [1:91] from 1845 to 1935: 19.6 19.6 19.6 12 28 ...
Note
This data set pairs with Lynx. The data are in units of one thousand.
Source
From Odum’s "Fundamentals of Ecology", p. 191. Data listed at: people.whitman.edu/~hundledr/courses/M250F03/LynxHar
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
Lynx
Description
HCT: Measurements made for 91 days on the three variables, log(white blood count) [WBC],
log(platelet) [PLT] and hematocrit [HCT]. Missing data code is 0 (zero).
Format
The format is: Time-Series [1:91] from 1 to 91: 30 30 28.5 34.5 34 32 30.5 31 33 34 ...
Details
See Examples 6.1 and 6.9 for more details.
Source
Jones, R.H. (1984). Fitting multivariate models to unequally spaced data. In Time Series Analysis
of Irregularly Observed Data, pp. 158-188. E. Parzen, ed. Lecture Notes in Statistics, 25, New
York: Springer-Verlag.
42 hor
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
blood, PLT, WBC
Description
Quarterly Hawaiian hotel occupancy rate (percent of rooms occupied) from 1982-I to 2015-IV
Format
The format is: Time-Series [1:136] from 1982 to 2015: 79 65.9 70.9 66.7 ...
Source
https://dbedt.hawaii.gov/economic/qser/tourism/
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
plot(hor, type='c') # plot data and
text(hor, labels=1:4, col=c(1,4,2,6), cex=.9) # add quarter labels
#
plot(stl(hor, s.window=15)) # fit structural model
jj 43
Description
Johnson and Johnson quarterly earnings per share, 84 quarters (21 years) measured from the first
quarter of 1960 to the last quarter of 1980.
Format
The format is: Time-Series [1:84] from 1960 to 1981: 0.71 0.63 0.85 0.44 0.61 0.69 0.92 0.55 0.72
0.77 ...
Details
This data set is also included with the R distribution as JohnsonJohnson
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Returns the filtered values for the basic time invariant state-space model; inputs are not allowed.
Usage
Kfilter0(num, y, A, mu0, Sigma0, Phi, cQ, cR)
Arguments
num number of observations
y data matrix, vector or time series
A time-invariant observation matrix
mu0 initial state mean vector
Sigma0 initial state covariance matrix
44 Kfilter0
Details
Value
Author(s)
D.S. Stoffer
References
Description
Returns both the predicted and filtered values for a linear state space model. Also evaluates the
likelihood at the given parameter values.
Usage
Kfilter1(num, y, A, mu0, Sigma0, Phi, Ups, Gam, cQ, cR, input)
Arguments
num number of observations
y data matrix, vector or time series
A time-varying observation matrix, an array with dim=c(q,p,n)
mu0 initial state mean
Sigma0 initial state covariance matrix
Phi state transition matrix
Ups state input matrix; use Ups = 0 if not needed
Gam observation input matrix; use Gam = 0 if not needed
cQ Cholesky-type decomposition of state error covariance matrix Q – see details
below
cR Cholesky-type decomposition of observation error covariance matrix R – see
details below
input matrix or vector of inputs having the same row dimension as y; use input = 0 if
not needed
Details
cQ and cR are the Cholesky-type decompositions of Q and R. In particular, Q = t(cQ)%*%cQ and R =
t(cR)%*%cR is all that is required (assuming Q and R are valid covariance matrices).
Value
xp one-step-ahead prediction of the state
Pp mean square prediction error
xf filter value of the state
Pf mean square filter error
like the negative of the log likelihood
innov innovation series
sig innovation covariances
Kn last value of the gain, needed for smoothing
46 Kfilter2
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Kfilter2 Kalman Filter - Model may be time varying or have inputs or corre-
lated errors
Description
Returns the filtered values for the state space model. In addition, the script returns the evaluation of
the likelihood at the given parameter values and the innovation sequence.
Usage
Kfilter2(num, y, A, mu0, Sigma0, Phi, Ups, Gam, Theta, cQ, cR,
S, input)
Arguments
num number of observations
y data matrix, vector or time series
A time-varying observation matrix, an array with dim = c(q,p,n)
mu0 initial state mean
Sigma0 initial state covariance matrix
Phi state transition matrix
Ups state input matrix; use Ups = 0 if not needed
Gam observation input matrix; use Gam = 0 if not needed
Theta state error pre-matrix
cQ Cholesky decomposition of state error covariance matrix Q – see details below
cR Cholesky-type decomposition of observation error covariance matrix R – see
details below
S covariance-type matrix of state and observation errors
input matrix or vector of inputs having the same row dimension as y; use input = 0 if
not needed
Ksmooth0 47
Details
Value
Author(s)
D.S. Stoffer
References
Ksmooth0 Kalman Filter and Smoother - Time invariant model without inputs
Description
Returns both the filtered values and smoothed values for the state-space model.
Usage
Arguments
num number of observations
y data matrix, vector or time series
A time-invariant observation matrix
mu0 initial state mean vector
Sigma0 initial state covariance matrix
Phi state transition matrix
cQ Cholesky-type decomposition of state error covariance matrix Q – see details
below
cR Cholesky-type decomposition of observation error covariance matrix R – see
details below
Details
cQ and cR are the Cholesky-type decompositions of Q and R. In particular, Q = t(cQ)%*%cQ and R =
t(cR)%*%cR is all that is required (assuming Q and R are valid covariance matrices).
Value
xs state smoothers
Ps smoother mean square error
x0n initial mean smoother
P0n initial smoother covariance
J0 initial value of the J matrix
J the J matrices
xp one-step-ahead prediction of the state
Pp mean square prediction error
xf filter value of the state
Pf mean square filter error
like the negative of the log likelihood
Kn last value of the gain
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Ksmooth1 49
Description
Returns both the filtered and the smoothed values for the state-space model.
Usage
Ksmooth1(num, y, A, mu0, Sigma0, Phi, Ups, Gam, cQ, cR, input)
Arguments
num number of observations
y data matrix, vector or time series
A time-varying observation matrix, an array with dim=c(q,p,n)
mu0 initial state mean
Sigma0 initial state covariance matrix
Phi state transition matrix
Ups state input matrix; use Ups = 0 if not needed
Gam observation input matrix; use Gam = 0 if not needed
cQ Cholesky-type decomposition of state error covariance matrix Q – see details
below
cR Cholesky-type decomposition of observation error covariance matrix R – see
details below
input matrix or vector of inputs having the same row dimension as y; use input = 0 if
not needed
Details
cQ and cR are the Cholesky-type decompositions of Q and R. In particular, Q = t(cQ)%*%cQ and R =
t(cR)%*%cR is all that is required (assuming Q and R are valid covariance matrices).
Value
xs state smoothers
Ps smoother mean square error
x0n initial mean smoother
P0n initial smoother covariance
J0 initial value of the J matrix
J the J matrices
xp one-step-ahead prediction of the state
50 Ksmooth2
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Ksmooth2 Kalman Filter and Smoother - General model, may have correlated
errors
Description
Returns the filtered and smoothed values for the state-space model. This is the smoother companion
to Kfilter2.
Usage
Ksmooth2(num, y, A, mu0, Sigma0, Phi, Ups, Gam, Theta, cQ, cR,
S, input)
Arguments
num number of observations
y data matrix, vector or time series
A time-varying observation matrix, an array with dim=c(q,p,n)
mu0 initial state mean
Sigma0 initial state covariance matrix
Phi state transition matrix
Ups state input matrix; use Ups = 0 if not needed
Gam observation input matrix; use Gam = 0 if not needed
Ksmooth2 51
Details
Value
xs state smoothers
Ps smoother mean square error
J the J matrices
xp one-step-ahead prediction of the state
Pp mean square prediction error
xf filter value of the state
Pf mean square filter error
like the negative of the log likelihood
Kn last value of the gain
Author(s)
D.S. Stoffer
References
Description
Produces a grid of scatterplots of a series versus lagged values of the series.
Usage
lag1.plot(series, max.lag=1, corr=TRUE, smooth=TRUE, col=gray(.1),
lwl=1, bgl ='white', box.col=8, ...)
Arguments
series the data
max.lag maximum lag
corr if TRUE, shows the autocorrelation value in a legend
smooth if TRUE, adds a lowess fit to each scatterplot
col color of points; default is gray(.1)
lwl width of lowess line; default is 1
bgl background of the ACF legend; default is 'white'
box.col color of the border of the ACF legend; default is 'gray(62)'
... additional graphical arguments
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
lag2.plot
Examples
lag1.plot(log(varve), max.lag=9)
lag1.plot(soi, 12, cex=1, pch=19, col=astsa.col(4, .3), gg=TRUE, corr=FALSE)
lag2.plot 53
Description
Produces a grid of scatterplots of one series versus another. The first named series is the one that
gets lagged.
Usage
lag2.plot(series1, series2, max.lag = 0, corr = TRUE, smooth = TRUE, col = gray(.1),
lwl=1, bgl ='white', box.col=8, ...)
Arguments
series1 first series (the one that gets lagged)
series2 second series
max.lag maximum number of lags
corr if TRUE, shows the cross-correlation value in a legend
smooth if TRUE, adds a lowess fit to each scatterplot
col color of points; default is gray(.1)
lwl width of lowess line; default is 1
bgl background of the ACF legend; default is 'white'
box.col color of the border of the ACF legend; default is 'gray(62)'
... additional graphical parameters
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
lag1.plot
54 LagReg
Examples
lag2.plot(soi, rec, max.lag=3)
lag2.plot(soi, rec, 8, cex=1.1, pch=19, col=5, bgl='transparent', lwl=2)
Description
Performs lagged regression as discussed in Chapter 4.
Usage
LagReg(input, output, L = c(3, 3), M = 40, threshold = 0,
inverse = FALSE)
Arguments
input input series
output output series
L degree of smoothing; see spans in the help file for spec.pgram.
M must be even; number of terms used in the lagged regression
threshold the cut-off used to set small (in absolute value) regression coeffcients equal to
zero
inverse if TRUE, will fit a forward-lagged regression
Details
For a bivariate series, input is the input series and output is the output series. The degree of
smoothing for the spectral estimate is given by L; see spans in the help file for spec.pgram. The
number of terms used in the lagged regression approximation is given by M, which must be even.
The threshold value is the cut-off used to set small (in absolute value) regression coeffcients equal
to zero (it is easiest to run LagReg twice, once with the default threshold of zero, and then again
after inspecting the resulting coeffcients and the corresponding values of the CCF). Setting in-
verse=TRUE will fit a forward-lagged regression; the default is to run a backward-lagged regres-
sion. The script is based on code that was contributed by Professor Doug Wiens, Department of
Mathematical and Statistical Sciences, University of Alberta.
Value
Graphs of the estimated impulse response function, the CCF, and the output with the predicted
values superimposed.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
LA Pollution-Mortality Study (1970-1979, weekly data).
Format
The format is: mts [1:508, 1:11]
Details
Note
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Leading indicator, 150 months; taken from Box and Jenkins (1970).
Usage
data(lead)
Format
The format is: Time-Series [1:150] from 1 to 150: 10.01 10.07 10.32 9.75 10.33 ...
Details
This is also the R time series BJsales.lead: The sales time series BJsales and leading indicator
BJsales.lead each contain 150 observations. The objects are of class "ts".
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
sales
Lynx 57
Description
This is one of the classic studies of predator-prey interactions, the 90-year data set is the number,
in thousands, of lynx pelts purchased by the Hudson’s Bay Company of Canada. While this is
an indirect measure of predation, the assumption is that there is a direct relationship between the
number of pelts collected and the number of hare and lynx in the wild.
Usage
data("Lynx")
Format
The format is: Time-Series [1:91] from 1845 to 1935: 30.1 45.1 49.1 39.5 21.2 ...
Note
The data are in units of one thousand. This data set pairs with Hare and is NOT the same as lynx.
Source
References
See Also
Hare
58 matrixpwr
Description
matrixpwr computes powers of a square matrix, including negative powers for nonsingular matri-
ces.
%^% is a more intuitive interface as an operator.
Usage
matrixpwr(A, power)
A %^% power
Arguments
A a square matrix
power single numeric
Details
Raises matrix to the specified power. The matrix must be square and if power < 0, the matrix must
be nonsingular.
Note that %^% is defined as "%^%" <-function(A,power) matrixpwr(A,power)
If power = 0, the identity matrix is returned.
Value
Returns matrix raised to the given power.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
mvspec 59
Examples
# 2-state Markov transition matrix to steady state
P = matrix(c(.7,.4,.3,.6), 2)
P %^% 50
Description
This is spec.pgram with a few changes in the defaults and written so you can easily extract the
estimate of the multivariate spectral matrix as fxx. The bandwidth calculation has been changed to
the more practical definition given in the text and this can be used to replace spec.pgram.
Usage
mvspec(x, spans = NULL, kernel = NULL, taper = 0, pad = 0,
fast = TRUE, demean = FALSE, detrend = TRUE,
plot = TRUE, log='n', type = NULL, na.action = na.fail,
nxm=2, nym=1, main=NULL, ...)
Arguments
x univariate or multivariate time series (i.e., the p columns of x are time series)
spans specify smoothing; same as spec.pgram
kernel specify kernel; same as spec.pgram
taper specify taper; same as spec.pgram with different default
pad specify padding; same as spec.pgram
fast specify use of FFT; same as spec.pgram
demean if TRUE, series is demeaned first; same as spec.pgram
detrend if TRUE, series is detrended first; same as spec.pgram
plot plot the estimate; same as spec.pgram
log same as spec.pgram but default is 'no'
type type of plot to be drawn, defaults to lines
na.action same as spec.pgram
nxm, nym the number of minor tick mark divisions on x-axis, y-axis; the default is one
minor tick on the x-axis and none on the y-axis
main title of the graphics; if NULL, a suitable title is generated
... graphical arguments passed to plot.spec
60 mvspec
Details
This is spec.pgram from the stats package with a few changes in the defaults and written so you
can easily extract the estimate of the multivariate spectral matrix as fxx. The default for the plot is
NOT to plot on a log scale and the graphic will have a grid. The bandwidth calculation has been
changed to the more practical definition given in the text, (Lh /n.used) ∗ f requency(x). Also,
the bandwidth is no longer displayed in the graphic. Although meant to be used to easily obtain
multivariate spectral estimates, this script can be used for univariate time series. Note that the script
does not taper by default (taper=0); this forces the user to do "conscious tapering".
Value
An object of class "spec", which is a list containing at least the following components:
References
Examples
# real raw periodogram
mvspec(soi)
mvspec(soi, log='y') # on a log scale
# multivariate example
ts.plot(mdeaths, fdeaths, col=1:2) # an R data set, male/female monthly deaths ...
dog = mvspec(cbind(mdeaths,fdeaths), spans=c(3,3), taper=.1)
dog$fxx # look a spectral matrix estimates
dog$bandwidth # bandwidth with time unit = year
dog$df # degrees of freedom
plot(dog, plot.type="coherency") # plot of squared coherency
Description
Returns of the New York Stock Exchange (NYSE) from February 2, 1984 to December 31, 1991.
Usage
data(nyse)
Format
The format is: Time-Series [1:2000] from 1 to 2000: 0.00335 -0.01418 -0.01673 0.00229 -0.01692
...
Source
S+GARCH module - Version 1.1 Release 2: 1998
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
62 part
Description
Crude oil, WTI spot price FOB (in dollars per barrel), weekly data from 2000 to mid-2010.
Format
The format is: Time-Series [1:545] from 2000 to 2010: 26.2 26.1 26.3 24.9 26.3 ...
Details
pairs with the series gas
Source
Data were obtained from the URL: www.eia.doe.gov/dnav/pet/pet_pri_spt_s1_w.htm
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
gas
Description
Particulate series corresponding to cmort from the LA pollution study.
Format
The format is: Time-Series [1:508] from 1970 to 1980: 72.7 49.6 55.7 55.2 66 ...
PLT 63
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
lap
Description
PLT: Measurements made for 91 days on the three variables, log(white blood count) [WBC],
log(platelet) [PLT] and hematocrit [HCT]. Missing data code is 0 (zero).
Usage
data(PLT)
Format
The format is: Time-Series [1:91] from 1 to 91: 4.47 4.33 4.09 4.6 4.41 ...
Details
See Examples 6.1 and 6.9 for more details.
Source
Jones, R.H. (1984). Fitting multivariate models to unequally spaced data. In Time Series Analysis
of Irregularly Observed Data, pp. 158-188. E. Parzen, ed. Lecture Notes in Statistics, 25, New
York: Springer-Verlag.
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
64 polio
See Also
Description
Monthly time series of poliomyelitis cases reported to the U.S. Centers for Disease Control for the
years 1970 to 1983, 168 observations.
Format
Details
The data were originally modelled by Zeger (1988) “A Regression Model for Time Series of
Counts,” Biometrika, 75, 822-835.
Source
References
Examples
tsplot(polio, type='s')
polyMul 65
Description
Multiplication of two polynomials.
Usage
polyMul(p, q)
Arguments
p coefficients of first polynomial
q coefficients of second polynomial
Details
inputs are vectors of coefficients a, b, c, ..., in order of power ax0 + bx1 + cx2 + ...
Value
coefficients of the product in order of power
Author(s)
D.S. Stoffer
Source
based on code from the polymatrix package https://github.com/namezys/polymatrix
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
a = 1:3 # 1 + 2x + 3x^2
b = 1:2 # 1 + 2x
polyMul(a, b)
# [1] 1 4 7 6
# 1 + 4x + 7x^2 + 6x^3
66 qinfl
Description
Monthly Federal Reserve Board Production Index (1948-1978, n = 372 months).
Usage
data(prodn)
Format
The format is: Time-Series [1:372] from 1948 to 1979: 40.6 41.1 40.5 40.1 40.4 41.2 39.3 41.6
42.3 43.2 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Quarterly inflation rate in the Consumer Price Index from 1953-Ito 1980-II, n = 110 observations.
Format
The format is: Time-Series [1:110] from 1953 to 1980: 1.673 3.173 0.492 -0.327 -0.333 ...
Details
pairs with qintr (interest rate)
Source
Newbold, P. and T. Bos (1985). Stochastic Parameter Regression Models. Beverly Hills: Sage.
qintr 67
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
qintr
Description
Quarterly interest rate recorded for Treasury bills from 1953-Ito 1980-II, n = 110 observations.
Format
The format is: Time-Series [1:110] from 1953 to 1980: 1.98 2.15 1.96 1.47 1.06 ...
Details
pairs with qinfl (inflation)
Source
Newbold, P. and T. Bos (1985). Stochastic Parameter Regression Models. Beverly Hills: Sage.
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
qinfl
68 rec
Description
Recruitment (index of the number of new fish) for a period of 453 months ranging over the years
1950-1987. Recruitment is loosely defined as an indicator of new members of a population to the
first life stage at which natural mortality stabilizes near adult levels.
Usage
data(rec)
Format
The format is: Time-Series [1:453] from 1950 to 1988: 68.6 68.6 68.6 68.6 68.6 ...
Details
Source
Data furnished by Dr. Roy Mendelssohn of the Pacific Fisheries Environmental Laboratory, NOAA
(personal communication). Further discussion of the concept of Recruitment may be found here:
derekogle.com/fishR/examples/oldFishRVignettes/StockRecruit.pdf
References
See Also
soi
sales 69
sales Sales
Description
Sales, 150 months; taken from Box and Jenkins (1970).
Format
The format is: Time-Series [1:150] from 1 to 150: 200 200 199 199 199 ...
Details
This is also the R data set BJsales: The sales time series BJsales and leading indicator BJsales.lead
each contain 150 observations. The objects are of class "ts".
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
lead
Description
Farm Bred Norwegian Salmon, export price, US Dollars per Kilogram
Format
The format is: Time-Series [1:166] from September 2003 to June 2017: 2.88 3.16 2.96 3.12 3.23
3.32 3.45 3.61 3.48 3.21 ...
Source
https://www.indexmundi.com/commodities/
70 salt
References
Description
Salt profiles taken over a spatial grid set out on an agricultural field, 64 rows at 17-ft spacing.
Usage
data(salt)
Format
Details
References
See Also
saltemp
saltemp 71
Description
Temperature profiles over a spatial grid set out on an agricultural field, 64 rows at 17-ft spacing.
Usage
data(saltemp)
Format
The format is: Time-Series [1:64] from 1 to 64: 5.98 6.54 6.78 6.34 6.96 6.51 6.72 7.44 7.74 6.85
...
Details
pairs with salt, salt profiles on the same grid
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
salt
Description
Fits ARIMA models (with diagnostics) in a short command. It can also be used to perform regres-
sion with autocorrelated errors.
Usage
sarima(xdata, p, d, q, P = 0, D = 0, Q = 0, S = -1,
details = TRUE, xreg=NULL, Model=TRUE,
fixed=NULL, tol = sqrt(.Machine$double.eps),
no.constant = FALSE, ...)
72 sarima
Arguments
xdata univariate time series
p AR order (must be specified)
d difference order (must be specified)
q MA order (must be specified)
P SAR order; use only for seasonal models
D seasonal difference; use only for seasonal models
Q SMA order; use only for seasonal models
S seasonal period; use only for seasonal models
xreg Optionally, a vector or matrix of external regressors, which must have the same
number of rows as xdata.
Model if TRUE (default), the model orders are printed on the diagnostic plot.
fixed optional numeric vector of the same length as the total number of parameters. If
supplied, only parameters corresponding to NA entries will be estimated.
details if FALSE, turns off the diagnostic plot and the output from the nonlinear opti-
mization routine, which is optim. The default is TRUE.
tol controls the relative tolerance (reltol in optim) used to assess convergence. The
default is sqrt(.Machine$double.eps), the R default.
no.constant controls whether or not sarima includes a constant in the model. In particular,
if there is no differencing (d = 0 and D = 0) you get the mean estimate. If
there is differencing of order one (either d = 1 or D = 1, but not both), a con-
stant term is included in the model. These two conditions may be overridden
(i.e., no constant will be included in the model) by setting this to TRUE; e.g.,
sarima(x,1,1,0,no.constant=TRUE). Otherwise, no constant or mean term
is included in the model. If regressors are included (via xreg), this is ignored.
... additional graphical arguments
Details
If your time series is in x and you want to fit an ARIMA(p,d,q) model to the data, the basic call
is sarima(x,p,d,q). The values p,d,q, must be specified as there is no default. The results are
the parameter estimates, standard errors, AIC, AICc, BIC (as defined in Chapter 2) and diagnos-
tics. To fit a seasonal ARIMA model, the basic call is sarima(x,p,d,q,P,D,Q,S). For example,
sarima(x,2,1,0) will fit an ARIMA(2,1,0) model to the series in x, and sarima(x,2,1,0,0,1,1,12)
will fit a seasonal ARIMA(2, 1, 0) ∗ (0, 1, 1)12 model to the series in x. The difference between the
information criteria given by sarima() and arima() is that they differ by a scaling factor of the
effective sample size.
Value
fit the arima object
degrees_of_freedom
Error degrees of freedom
ttable a little t-table with two-sided p-values
sarima.for 73
AIC value of the AIC - all ICs are the values reported in fit divided by the essential
number of observations (after differencing)
AICc value of the AICc
BIC value of the BIC
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
sarima.for
Examples
sarima(log(AirPassengers),0,1,1,0,1,1,12)
# fixed parameters
x = sarima.sim( ar=c(0,-.9), n=200 ) + 50
sarima(x, 2,0,0, fixed=c(0,NA,NA))
Description
ARIMA forecasting.
Usage
sarima.for(xdata,n.ahead,p,d,q,P=0,D=0,Q=0,S=-1,tol=sqrt(.Machine$double.eps),
no.constant=FALSE, plot=TRUE, plot.all=FALSE,
xreg = NULL, newxreg = NULL, fixed=NULL, ...)
74 sarima.for
Arguments
xdata univariate time series
n.ahead forecast horizon (number of periods)
p AR order
d difference order
q MA order
P SAR order; use only for seasonal models
D seasonal difference; use only for seasonal models
Q SMA order; use only for seasonal models
S seasonal period; use only for seasonal models
tol controls the relative tolerance (reltol) used to assess convergence. The default is
sqrt(.Machine$double.eps), the R default.
no.constant controls whether or not a constant is included in the model. If no.constant=TRUE,
no constant is included in the model. See sarima for more details.
plot if TRUE (default) the data (or some of it) and the forecasts and bounds are
plotted
plot.all if TRUE, all the data are plotted in the graphic; otherwise, only the last 100
observations are plotted in the graphic.
xreg Optionally, a vector or matrix of external regressors, which must have the same
number of rows as the series. If this is used, newxreg MUST be specified.
newxreg New values of xreg to be used for prediction. Must have at least n.ahead rows.
fixed optional numeric vector of the same length as the total number of parameters. If
supplied, only parameters corresponding to NA entries will be estimated.
... additional graphical arguments
Details
For example, sarima.for(x,5,1,0,1) will forecast five time points ahead for an ARMA(1,1) fit
to x. The output prints the forecasts and the standard errors of the forecasts, and supplies a graphic
of the forecast with +/- 1 and 2 prediction error bounds.
Value
pred the forecasts
se the prediction (standard) errors
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
sarima.sim 75
See Also
sarima
Examples
sarima.for(log(AirPassengers),12,0,1,1,0,1,1,12)
# with regressors:
nummy = length(soi)
n.ahead = 24
nureg = time(soi)[nummy] + seq(1,n.ahead)/12
sarima.for(soi,n.ahead,2,0,0,2,0,0,12, xreg=time(soi), newxreg=nureg)
Description
Simulate data from (seasonal) ARIMA models.
Usage
sarima.sim(ar = NULL, d = 0, ma = NULL, sar = NULL, D = 0, sma = NULL, S = NULL,
n = 500, rand.gen = rnorm, innov = NULL, burnin = NA, t0 = 0, ...)
Arguments
ar coefficients of AR component (does not have to be specified)
d order of regular difference (does not have to be specified)
ma coefficients of MA component (does not have to be specified)
sar coefficients of SAR component (does not have to be specified)
D order of seasonal difference (does not have to be specified)
sma coefficients of SMA component (does not have to be specified)
S seasonal period (does not have to be specified)
n desired sample size (defaults to 500)
rand.gen optional; a function to generate the innovations (defaults to normal)
innov an optional times series of innovations. If not provided, rand.gen is used.
burnin length of burn-in (a non-negative integer). If NA (the default) a reasonable value
is selected.
t0 start time (defaults to 0)
76 sarima.sim
... additional arguments applied to the innovations. For rand.gen, the standard
deviation of the innovations generated by rnorm can be specified by sd or the
mean by mean (see details and examples). In addition, rand.gen may be over-
ridden using a preset sequence of innovations specifying innov (see details and
examples).
Details
Will generate a time series of length n from the specified SARIMA model using simplified input.
The use of the term mean in . . . refers to the generation of normal innovations. For example,
sarima.sim(ar=.9,mean=5) will generate data using N(5,1) or 5+N(0,1) innovations, so that the
constant in the model is 5 and the mean of the AR model is 5/(1-.9) = 50. In sarima.sim(ma=.9,mean=5),
however, the model mean is 5 (the constant). Also, a random walk with drift = .1 can be generated by
sarima.sim(d=1,mean=.1,burnin=0), which is equivalent to cumsum(rnorm(500,mean=.1)).
The same story goes if sd is specified; i.e., it’s applied to the innovations. Because anything spec-
ified in . . . refers to the innovations, a simpler way to generate a non-zero mean is to add the value
outside the call; see the examples.
If innov is used to input the innovations and override rand.gen, be sure that length(innov) is at
least n + burnin. If the criterion is not met, the script will return less than the desired number of
values and a warning will be given.
Value
A time series of length n from the specified SARIMA model with the specified frequency if the
model is seasonal and start time t0.
Note
The model autoregressive polynomial (’AR side’ = AR x SAR) is checked for causality and the
model moving average polynomial (’MA side’ = MA x SMA) is checked invertibility. The script
stops and reports an error at the first violation of causality or invertibility; i.e., it will not report
multiple errors.
Author(s)
D.S. Stoffer
References
Examples
## AR(2) with mean 50 [n = 500 is default]
y = sarima.sim(ar=c(1.5,-.75)) + 50
tsplot(y)
Description
Draws a scatterplot with histograms in the margins.
Usage
scatter.hist(x, y, xlab = NULL, ylab = NULL, title = NULL, pt.size = 1,
hist.col = gray(0.82), pt.col = gray(0.1, 0.25), pch = 19,
reset.par = TRUE, ...)
Arguments
x vector of x-values
y corresponding vector of y-values
xlab x-axis label (defaults to name of x)
78 SigExtract
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Examples
scatter.hist(tempr, cmort, hist.col=astsa.col(5,.4), pt.col=5, pt.size=1.5, reset=FALSE)
lines(lowess(tempr, cmort), col=6)
Description
Performs signal extraction and optimal filtering as discussed in Chapter 4.
Usage
SigExtract(series, L = c(3, 3), M = 50, max.freq = 0.05)
Arguments
series univariate time series to be filtered
L degree of smoothing (may be a vector); see spans in spec.pgram for more
details
M number of terms used in the lagged regression approximation
max.freq truncation frequency, which must be larger than 1/M.
so2 79
Details
The basic function of the script, and the default setting, is to remove frequencies above 1/20 (and,
in particular, the seasonal frequency of 1 cycle every 12 time points). The sampling frequency of
the time series is set to unity prior to the analysis.
Value
Returns plots of (1) the original and filtered series, (2) the estiamted spectra of each series, (3) the
filter coefficients and the desired and attained frequency response function. The filtered series is
returned invisibly.
Note
The script is based on code that was contributed by Professor Doug Wiens, Department of Mathe-
matical and Statistical Sciences, University of Alberta.
Author(s)
D.S. Stoffer
References
Description
Format
The format is: Time-Series [1:508] from 1970 to 1980: 3.37 2.59 3.29 3.04 3.39 2.57 2.35 3.38 1.5
2.56 ...
80 soi
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
lap
Description
Southern Oscillation Index (SOI) for a period of 453 months ranging over the years 1950-1987.
Format
The format is: Time-Series [1:453] from 1950 to 1988: 0.377 0.246 0.311 0.104 -0.016 0.235 0.137
0.191 -0.016 0.29 ...
Details
pairs with rec (Recruitment)
Source
Data furnished by Dr. Roy Mendelssohn of the Pacific Fisheries Environmental Laboratory, NOAA
(personal communication).
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
rec
soiltemp 81
Description
A 64 by 36 matrix of surface soil temperatures.
Format
The format is: num [1:64, 1:36] 6.7 8.9 5 6.6 6.1 7 6.5 8.2 6.7 6.6 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Weekly closing returns of the SP 500 from 2003 to September, 2012.
Format
An ’xts’ object on 2003-01-03 to 2012-09-28; Indexed by objects of class: [Date] TZ: UTC
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
82 spec.ic
Description
Fits an AR model to data and computes (and by default plots) the spectral density of the fitted model
based on AIC (default) or BIC.
Usage
Arguments
Details
Uses ar to fit the best AR model based on pseudo AIC or BIC. No likelihood is calculated unless
method='mle' is used, however, the calculations will be slow. The minimum centered AIC and
BIC values and the spectral and frequency ordinates are returned silently.
Value
Author(s)
D.S. Stoffer
specenv 83
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
ar, spec.ar
Examples
## Not run:
# AIC
spec.ic(soi)
spec.ic(sunspotz, method='burg', col=4)
## End(Not run)
Description
Computes the spectral envelope of categorical-valued or real-valued time series.
Usage
specenv(xdata, section = NULL, spans = NULL, significance = 1e-04,
plot = TRUE, ylim = NULL, real = FALSE, ...)
Arguments
xdata For categorical-valued sequences, a matrix with rows that are indicators of the
categories represented by the columns, possibly a sequence converted using
dna2vector. For real-valued sequences, a matrix with at least two columns
that are various transformations of the data.
section of the form start:end where start < end are non-negative integers; specifies
the section used in the analysis - default is the entire sequence.
84 specenv
Details
Calculates the spectral envelope for categorical-valued series as discussed in https://www.stat.pitt.edu/stoffer/dss_f
and summarized in https://doi.org/10.1214/ss/1009212816. Alternately, calculates the spec-
tral envelope for real-valued series as discussed in https://doi.org/10.1016/S0378-3758(96)00044-4.
These concepts are also presented (with examples) in Section 7.9 (Chapter 7) of Time Series Anal-
ysis and Its Applications: With R Examples: https://www.stat.pitt.edu/stoffer/tsa4/.
For categorical-valued series, the input xdata must be a matrix of indicators which is perhaps a
sequence preprocessed using dna2vector.
For real-valued series, the input xdata should be a matrix whose columns are various transforma-
tions of the univariate series.
Value
By default, will produce a graph of the spectral envelope and an approximate significance threshold.
A matrix containing: frequency, spectral envelope ordinates, and (1) the scalings of the categories in
the order of the categories in the alphabet or (2) the coefficients of the transformations, is returned
invisibly.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
dna2vector
speech 85
Examples
## Not run:
# a DNA sequence
data = bnrf1ebv
xdata = dna2vector(data)
u = specenv(xdata, section=1:1000, spans=c(7,7))
head(u) # scalings are for A, C, G, and last one T=0 always
## End(Not run)
Description
A small .1 second (1000 points) sample of recorded speech for the phrase "aaa...hhh".
Format
The format is: Time-Series [1:1020] from 1 to 1020: 1814 1556 1442 1416 1352 ...
References
Description
Fits a simple univariate state space model, x[t] = alpha + phi x[t-1] + w[t], and y[t] = A x[t] + v[t].
The parameters alpha, phi, sigma[w] and sigma[v] are estimated; parameter phi may be fixed. State
predictions and smoothers and corresponding error variances are evaluated at the estimates. The
sample size must be at least 20.
Usage
ssm(y, A, phi, alpha, sigw, sigv, fixphi = FALSE)
Arguments
y data
A measurement value (fixed constant)
phi initial value of phi, may be fixed
alpha initial value for alpha
sigw initial value for sigma[w]
sigv initial value for sigma[v]
fixphi if TRUE, the phi parameter is fixed
Details
The script works for a specific univariate state space model. The initial state conditions use a default
calculation and cannot be specified. The parameter estimates are printed and the script returns the
state predictors and smoothers.
Value
At the MLEs, these are returned invisibly:
Author(s)
D.S. Stoffer
star 87
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
The magnitude of a star taken at midnight for 600 consecutive days. The data are taken from the
classic text, The Calculus of Observations, a Treatise on Numerical Mathematics, by E.T. Whittaker
and G. Robinson, (1923, Blackie and Son, Ltd.).
Format
The format is: Time-Series [1:600] from 1 to 600: 25 28 31 32 33 33 32 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Performs frequency domain stochastic regression discussed in Chapter 7.
Usage
stoch.reg(data, cols.full, cols.red, alpha, L, M, plot.which)
88 stoch.reg
Arguments
Value
Note
The script is based on code that was contributed by Professor Doug Wiens, Department of Mathe-
matical and Statistical Sciences, University of Alberta.
Author(s)
D.S. Stoffer
References
Description
Biannual smoothed (12-month moving average) number of sunspots from June 1749 to December
1978; n = 459. The "z" on the end is to distinguish this series from the one included with R (called
sunspots).
Format
The format is: Time Series: Start = c(1749, 1) End = c(1978, 1) Frequency = 2
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Performs a special case switching filter when the observational noise is a certain mixture of normals.
Used to fit a stochastic volatility model.
Usage
SVfilter(num, y, phi0, phi1, sQ, alpha, sR0, mu1, sR1)
Arguments
num number of observations
y time series of returns
phi0 state constant
phi1 state transition parameter
sQ state standard deviation
alpha observation constant
sR0 observation error standard deviation for mixture component zero
mu1 observation error mean for mixture component one
sR1 observation error standard deviation for mixture component one
90 tempr
Value
xp one-step-ahead prediction of the volatility
Pp mean square prediction error of the volatility
like the negative of the log likelihood at the given parameter values
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
Temperature series corresponding to cmort from the LA pollution study.
Format
The format is: Time-Series [1:508] from 1970 to 1980: 72.4 67.2 62.9 72.5 74.2 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
lap
test.linear 91
Description
Produces a plot of the tail probabilities of a normalized bispectrum of a series under the assumption
the model is a linear process with iid innovations.
Usage
Arguments
Value
Note
The null hypothesis is that the data are from a linear process with i.i.d. innovations. Under the null
hypothesis, the bispectrum is constant over all frequencies. Chi-squared test statistics are formed in
blocks to measure departures from the null hypothesis and the corresponding p-values are displayed
in a graphic and returned invisibly. Details are in Hinich, M. and Wolinsky, M. (2005). Normalizing
bispectra. Journal of Statistical Planning and Inference, 130, 405–411.
Author(s)
D.S. Stoffer
References
Examples
## Not run:
test.linear(nyse) # :(
test.linear(soi) # :)
## End(Not run)
Description
Produces a nice plot of univariate or multiple time series in one easy line.
Usage
tsplot(x, y=NULL, main=NULL, ylab=NULL, xlab='Time', type=NULL,
margins=.25, ncolm=1, byrow=TRUE, minor=TRUE, nxm=2, nym=1,
xm.grid=TRUE, ym.grid =TRUE, col=1, gg=FALSE, spaghetti=FALSE,
pch=NULL, lty=1, lwd=1, ...)
Arguments
x, y time series to be plotted; if both present, x will be the time index.
main add a plot title - the default is no title.
ylab y-axis label - the default is the name of the ts object.
xlab x-axis label - the default is ’Time’.
type type of plot - the default is line.
margins inches to add (or subtract) to the margins.
ncolm for multiple time series, the number of columns to plot.
byrow for multiple time series - if TRUE (default), plot series row wise; if FALSE, plot
series column wise.
minor, nxm, nym if minor=TRUE, the number of minor tick marks on x-axis, y-axis. minor=FALSE
removes both or set either to 0 or 1 to remove. The default is one minor tick on
the x-axis and none on the y-axis.
xm.grid, ym.grid
if TRUE (default), adds grid lines at minor x-axis, y-axis ticks.
col line color(s), can be a vector for multiple time series.
gg if TRUE, will produce a gris-gris plot (gray graphic interior with white grid
lines); the default is FALSE. The grammar of astsa is voodoo; see https://musicaficionado.blog/201
spaghetti if TRUE, will produce a spaghetti plot (all series on same plot).
pch plot symbols (default is 1, circle); can be a vector for multiple plots.
lty line type (default is 1, solid line); can be a vector for multiple plots.
lwd line width (default is 1); can be a vector for multiple plots.
... other graphical parameteres; see par.
unemp 93
Author(s)
D.S. Stoffer
References
Examples
## Not run:
tsplot(soi, col=4, main="Southern Oscillation Index")
#
tsplot(1:453, soi, ylab='SOI', xlab='Month')
#
tsplot(climhyd, ncolm=2, gg=TRUE, col=2:7, lwd=2) # gris-gris plot
#
x <- replicate(100, cumsum(rcauchy(1000))/1:1000)
tsplot(x, col=1:8, main='No LLN For You', spaghetti=TRUE)
## End(Not run)
Description
Usage
data(unemp)
Format
The format is: Time-Series [1:372] from 1948 to 1979: 235 281 265 241 201 ...
94 UnempRate
References
See Also
UnempRate
Description
Monthly U.S. unemployment rate in percent unemployed (Jan, 1948 - Nov, 2016, n = 827)
Format
The format is: Time-Series [1:827] from 1948 to 2017: 4 4.7 4.5 4 3.4 3.9 3.9 3.6 3.4 2.9 ...
Source
https://data.bls.gov/timeseries/LNU04000000/
References
See Also
unemp
varve 95
Description
Sedimentary deposits from one location in Massachusetts for 634 years, beginning nearly 12,000
years ago.
Format
The format is: Time-Series [1:634] from 1 to 634: 26.3 27.4 42.3 58.3 20.6 ...
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
Description
WBC: Measurements made for 91 days on the three variables, log(white blood count) [WBC],
log(platelet) [PLT] and hematocrit [HCT]. Missing data code is 0 (zero).
Format
The format is: Time-Series [1:91] from 1 to 91: 2.33 1.89 2.08 1.82 1.82 ...
Details
See Examples 6.1 amd 6.9 for more details.
Source
Jones, R.H. (1984). Fitting multivariate models to unequally spaced data. In Time Series Analysis
of Irregularly Observed Data, pp. 158-188. E. Parzen, ed. Lecture Notes in Statistics, 25, New
York: Springer-Verlag.
96 WBC
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/
blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.
stat.pitt.edu/stoffer/tsda/.
See Also
blood, HCT, PLT
Index
∗ color Lynx, 57
astsa.col, 11 nyse, 61
∗ datasets oil, 62
ar1miss, 8 part, 62
arf, 9 PLT, 63
beamd, 12 polio, 64
birth, 13 prodn, 66
blood, 14 qinfl, 66
bnrf1ebv, 15 qintr, 67
bnrf1hvs, 15 rec, 68
cardox, 16 sales, 69
chicken, 18 salmon, 69
climhyd, 18 salt, 70
cmort, 19 saltemp, 71
cpg, 20 so2, 79
djia, 20 soi, 80
EBV, 22 soiltemp, 81
econ5, 23 sp500w, 81
EQ5, 27 speech, 85
eqexp, 28 star, 87
EXP6, 29 sunspotz, 89
flu, 30 tempr, 90
fmri, 31 unemp, 93
fmri1, 32 UnempRate, 94
gas, 33 varve, 95
gdp, 33 WBC, 95
globtemp, 34 ∗ manip
globtempl, 35 dna2vector, 21
gnp, 36 ∗ math
gtemp, 38 matrixpwr, 58
gtemp2, 38 polyMul, 65
gtemp_land, 39 ∗ package
gtemp_ocean, 40 astsa-package, 4
Hare, 40 ∗ ts
HCT, 41 acf1, 4
hor, 42 acf2, 6
jj, 43 acfm, 7
lap, 55 arma.spec, 9
lead, 56 ARMAtoAR, 10
97
98 INDEX
astsa-package, 4 cpg, 20
ccf2, 16
EM0, 24 djia, 20
EM1, 25 dna2vector, 21, 23, 83, 84
Kfilter0, 43
Kfilter1, 45 EBV, 22
Kfilter2, 46 econ5, 23
Ksmooth0, 47 EM0, 24
Ksmooth1, 49 EM1, 25
Ksmooth2, 50 EQ5, 27
lag1.plot, 52 EQcount, 27
lag2.plot, 53 eqexp, 27, 28, 29
LagReg, 54 EXP6, 29
mvspec, 59
FDR, 29
sarima, 71
flu, 30
sarima.for, 73
fmri, 31, 32
sarima.sim, 75
fmri1, 32
SigExtract, 78
specenv, 83 gas, 33, 62
ssm, 86 gdp, 33, 36
stoch.reg, 87 globtemp, 34, 35, 38–40
SVfilter, 89 globtempl, 35, 35, 38–40
test.linear, 91 gnp, 36
tsplot, 92 Grid, 36
%^% (matrixpwr), 58 grid, 37
gtemp, 35, 38, 39
acf1, 4
gtemp2, 35, 38, 38, 40
acf2, 6
gtemp_land, 35, 38, 39, 39, 40
acfm, 7
gtemp_ocean, 35, 38–40, 40
ar, 83
ar1miss, 8 Hare, 40, 57
arf, 9 HCT, 14, 41, 64, 96
arma.spec, 9 hor, 42
ARMAtoAR, 10
astsa (astsa-package), 4 jj, 43
astsa-package, 4
astsa.col, 11 Kfilter0, 43
Kfilter1, 45
beamd, 12 Kfilter2, 46
birth, 13 Ksmooth0, 47
blood, 14, 42, 64, 96 Ksmooth1, 49
bnrf1ebv, 15 Ksmooth2, 50
bnrf1hvs, 15
lag1.plot, 52, 53
cardox, 16 lag2.plot, 52, 53
ccf2, 16 LagReg, 54
chicken, 18 lap, 19, 55, 63, 80, 90
climhyd, 18 lead, 56, 69
cmort, 19 Lynx, 41, 57
INDEX 99
lynx, 57 varve, 95
nyse, 61
oil, 33, 62
par, 92
part, 62
PLT, 14, 42, 63, 96
polio, 64
polyMul, 65
prodn, 66
qinfl, 66, 67
qintr, 67, 67
rec, 68, 80
sales, 56, 69
salmon, 69
salt, 70, 71
saltemp, 70, 71
sarima, 71, 74, 75
sarima.for, 73, 73
sarima.sim, 75
scatter.hist, 77
SigExtract, 78
so2, 79
soi, 68, 80
soiltemp, 81
sp500w, 81
spec.ar, 83
spec.ic, 82
specenv, 21, 22, 83
speech, 85
ssm, 86
star, 87
stoch.reg, 87
sunspotz, 89
SVfilter, 89
tempr, 90
test.linear, 91
tsplot, 5–7, 17, 92
unemp, 93, 94
UnempRate, 94, 94