Sei sulla pagina 1di 101

The forecasting Package

July 28, 2007

Contains forecast fma Mcomp

Version 1.07

Date 2007-07-25

Depends R (>= 2.0.0), graphics, stats, tseries

LazyData yes
LazyLoad yes

Author Rob J Hyndman <Rob.Hyndman@buseco.monash.edu.au>

Maintainer Rob J Hyndman <Rob.Hyndman@buseco.monash.edu.au>

License GPL (version 2 or later).

URL http://www.robhyndman.info/Rlibrary/forecast/
Contents

Package forecast 1
BoxCox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
arima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
arima.errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
best.arima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
croston . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
ets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
fitted.Arima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
forecast.Arima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
forecast.HoltWinters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
forecast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
forecast.StructTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
forecasterrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
forecast.ets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
plot.forecast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
gas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
gof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
gold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
meanf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
monthdays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
na.interp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
ndiffs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
plot.ets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
rwf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
seasadj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
seasonaldummy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
seasonplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
ses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
simulate.ets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
sindexf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
splinef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
thetaf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
tsdisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
wineind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
woolyrnq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

i
ii CONTENTS

Package fma 39
advert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
advsales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
airpass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
auto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
bank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
beer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
bicoal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
boston . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
bricksq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
canadian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
capital . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
cement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
chicken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
condmilk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
copper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
copper1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
copper2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
copper3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
cowtemp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
cpimel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
dexter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
dj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
dole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
dowjones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
econsumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
eggs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
eknives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
elco . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
elec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
expenditure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
fancy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
french . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
housing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
hsales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
hsales2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
huron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
ibm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
ibmclose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
invent15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
jcars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
kkong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
labour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
lynx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
milk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
CONTENTS iii

mink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
mortal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
motel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
nail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
oilprice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
olympic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
ozone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
paris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
pcv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
petrol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
pigs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
plastics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
pollution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
productC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
pulpprice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
qelec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
qsales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
sales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
schizo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
shampoo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
sheep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
shipex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
strikes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
telephone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
texasgas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
ukdeaths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
usdeaths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
uselec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
ustreas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
wagesuk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
wheat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
wn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
wnoise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Package Mcomp 89
M1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
plot.Mdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
subset.Mcomp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

Index 93
iv CONTENTS
Package forecast

Title Forecasting functions for time series


Description Various functions to aid in univariate time series forecasting including exponential
smoothing via state space models, arima models, and many more.

BoxCox Box Cox Transformation

Description
BoxCox() returns a transformation of the input variable using a Box-Cox transformation. InvBox-
Cox() reverses the transformation.

Usage
BoxCox(x,lambda)
InvBoxCox(x,lambda)

Arguments
x a numeric vector or time series
lambda transformation parameter

Details
The Box-Cox transformation is given by

x 1
f (x) =

if 6= 0. For = 0,
f0 (x) = log(x)
.

Value
a numeric vector of the same length as x.

1
2 arima

Author(s)
Rob J Hyndman

References
Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26 211246.

Examples
lynx.sqrt <- BoxCox(lynx,0.5)
lynx.fit <- ar(lynx.sqrt)
plot(forecast(lynx.fit,h=20),lambda=0.5)

arima Fit ARIMA model to univariate time series

Description
Largely a wrapper for the arima function in the stats package. The main difference is that this
function returns some additional information that is required by the forecast.Arima function.
Also, it is possible to take an ARIMA model from a previous call to arima and re-apply it to the
data x.

Usage
arima(x, order = c(0, 0, 0), seasonal = list(order = c(0, 0, 0), period = NA),
xreg = NULL, include.mean = TRUE, include.drift = FALSE,
transform.pars = TRUE, fixed = NULL, init = NULL,
method = c("CSS-ML", "ML", "CSS"), n.cond,
optim.control = list(), kappa = 1e6, model=NULL)

Arguments
x a univariate time series
order A specification of the non-seasonal part of the ARIMA model: the three com-
ponents (p, d, q) are the AR order, the degree of differencing, and the MA order.
seasonal A specification of the seasonal part of the ARIMA model, plus the period (which
defaults to frequency(x)). This should be a list with components order and pe-
riod, but a specification of just a numeric vector of length 3 will be turned into a
suitable list with the specification as the order.
xreg Optionally, a vector or matrix of external regressors, which must have the same
number of rows as x.
include.mean Should the ARIMA model include a mean term? The default is TRUE for un-
differenced series, FALSE for differenced ones (where a mean would not affect
the fit nor predictions).
arima 3

include.drift
Should the ARIMA model include a linear drift term? (i.e., a linear regression
with ARIMA errors is fitted.) The default is FALSE.
transform.pars
Logical. If true, the AR parameters are transformed to ensure that they remain
in the region of stationarity. Not used for method = "CSS".
fixed optional numeric vector of the same length as the total number of parameters.
If supplied, only NA entries in fixed will be varied. transform.pars = TRUE
will be overridden (with a warning) if any AR parameters are fixed. It may be
wise to set transform.pars = FALSE when fixing MA parameters, especially near
non-invertibility.
init optional numeric vector of initial parameter values. Missing values will be filled
in, by zeroes except for regression coefficients. Values already specified in fixed
will be ignored.
method Fitting method: maximum likelihood or minimize conditional sum-of-squares.
The default (unless there are missing values) is to use conditional-sum-of-squares
to find starting values, then maximum likelihood.
n.cond Only used if fitting by conditional-sum-of-squares: the number of initial obser-
vations to ignore. It will be ignored if less than the maximum lag of an AR
term.
optim.control
List of control parameters for optim.
kappa the prior variance (as a multiple of the innovations variance) for the past obser-
vations in a differenced model. Do not reduce this.
model Output from a previous call to arima. If model is passed, this same model is
fitted to x without re-estimating any parameters.

Details
See the arima function in the stats package.

Value
See the arima function in the stats package. The additional objects returned are

x The time series data


xreg The regressors used in fitting (when relevant).

Author(s)
Rob J Hyndman

See Also
arima
4 arima.errors

Examples
fit <- arima(WWWusage,order=c(3,1,0))
plot(forecast(fit,h=20))

air.model <- arima(AirPassengers[1:100],c(0,1,1))


air.model2 <- arima(AirPassengers,model=air.model)
outofsample <- ts(fitted(air.model2)[-c(1:100)],s=1957+4/12,f=12)

arima.errors ARIMA errors

Description
Returns original time series after adjusting for regression variables. These are not the same as the
residuals. If there are no regression variables in the ARIMA model, then the errors will be identical
to the original series. If there are regression variables in the ARIMA model, then the errors will
be equal to the original series minus the effect of the regression variables, but leaving in the serial
correlation that is modelled with the AR and MA terms. If you want the "residuals", then use
residuals(z)..

Usage
arima.errors(z)

Arguments
z Fitted ARIMA model from arima

Value
A time series containing the "errors".

Author(s)
Rob J Hyndman

See Also
arima, residuals

Examples
ukdeaths.fit <- arima(UKDriverDeaths,c(1,0,1),c(0,1,1),xreg=Seatbelts[,"law"])
ukdeaths.errors <- arima.errors(ukdeaths.fit)
par(mfrow=c(2,1))
plot(UKDriverDeaths)
plot(ukdeaths.errors)
best.arima 5

best.arima Fit best ARIMA model to univariate time series

Description
Returns best ARIMA model according to either AIC, AICc or BIC value. The function conducts a
search over possible model within the order constraints provided.

Usage
auto.arima(x, d = NA, D = NA, max.p = 5, max.q = 5,
max.P = 2, max.Q = 2, max.order = 5,
start.p=2, start.q=2, start.P=1, start.Q=1,
stationary = FALSE, ic = c("aic","aicc", "bic"),
stepwise=TRUE, trace=FALSE)

Arguments
x a univariate time series
d Order of first-differencing. If missing, will choose a value based on KPSS test.
D Order of seasonal-differencing. If missing, will choose a value based on CH
test.
max.p Maximum value of p
max.q Maximum value of q
max.P Maximum value of P
max.Q Maximum value of Q
max.order Maximum value of p+q+P+Q if model selection is not stepwise.
start.p Starting value of p in stepwise procedure.
start.q Starting value of q in stepwise procedure.
start.P Starting value of P in stepwise procedure.
start.Q Starting value of Q in stepwise procedure.
stationary If TRUE, restricts search to stationary models.
ic Information criterion to be used in model selection.
stepwise If TRUE, will do stepwise selection (faster). Otherwise, it searches over all mod-
els. Non-stepwise selection can be very slow, especially for seasonal models.
trace If TRUE, the list of ARIMA models considered will be reported.

Details
Non-stepwise selection can be slow, especially for seasonal data. Non-seasonal differences chosen
using kpss.test. Seasonal differences chosen using a variation on the Canova-Hansen test.
Stepwise algorithm outlined in Hyndman and Khandakar (2007).
6 croston

Value
Same as for arima

Author(s)
Rob J Hyndman

References
Hyndman, R.J. and Khandakar, Y. (2007) "Automatic time series forecasting: The forecast package
for R", Journal of Statistical Software, to appear.

See Also
arima

Examples
fit <- auto.arima(WWWusage)
plot(forecast(fit,h=20))

croston Forecasts for intermittent demand using Crostons method

Description
Returns forecasts and other information for Crostons forecasts applied to x.

Usage
croston(x, h=10, alpha=0.1)

Arguments
x a numeric vector or time series
h Number of periods for forecasting.
alpha Value of alpha. Default value is 0.1.

Details
Based on Crostons (1972) method for intermittent demand forecasting, also described in Shenstone
and Hyndman (2005). Crostons method involves using simple exponential smoothing (SES) on the
non-zero elements of the time series and a separate application of SES to the times between non-
zero elements of the time series. The smoothing parameters of the two applications of SES are
assumed to be equal and are denoted by alpha.
Note that prediction intervals are not computed as Crostons method has no underlying stochastic
model.
croston 7

Value

An object of class "forecast" is a list containing at least the following elements:

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by croston and associated functions.

Author(s)

Rob J Hyndman

References

Croston, J. (1972) "Forecasting and stock control for intermittent demands", Operational Research
Quarterly, 23(3), 289-303.
Shenstone, L., and Hyndman, R.J. (2005) "Stochastic models underlying Crostons method for
intermittent demand forecasting". Journal of Forecasting, 24, 389-402.

See Also

ses.

Examples

x <- rpois(20,lambda=.3)
fcast <- croston(x)
plot(fcast)
8 ets

ets Exponential smoothing state space model

Description
Returns ets model applied to x.

Usage
ets(y, model="ZZZ", damped=NULL, alpha=NULL, beta=NULL, gamma=NULL, phi=NULL,
additive.only=FALSE, lower=c(rep(0.01,3), 0.8), upper=c(rep(0.99,3),0.98),
opt.crit=c("lik","amse","mse","sigma"), nmse=3,
bounds=c("both","usual","admissible"), ic=c("aic","aicc","bic"))

Arguments
y a numeric vector or time series
model Usually a three-character string identifying method using the framework termi-
nology of Hyndman et al. (2002) and Hyndman et al. (2008). The first letter
denotes the error type ("A", "M" or "Z"); the second letter denotes the trend type
("N","A","M" or "Z"); and the third letter denotes the season type ("N","A","M"
or "Z"). In all cases, "N"=none, "A"=additive, "M"=multiplicative and "Z"=automatically
selected. So, for example, "ANN" is simple exponential smoothing with addi-
tive errors, "MAM" is multiplicative Holt-Winters method with multiplicative
errors, and so on. It is also possible for the model to be equal to the output
from a previous call to ets. In this case, the same model is fitted to y without
re-estimating any parameters.
damped If TRUE, use a damped trend (either additive or multiplicative). If NULL, both
damped and non-damped trends will be tried and the best model (according to
the information criterion ic) returned.
alpha Value of alpha. If NULL, it is estimated.
beta Value of beta. If NULL, it is estimated.
gamma Value of gamma. If NULL, it is estimated.
phi Value of phi. If NULL, it is estimated.
additive.only
If TRUE, will only consider additive models. Default is FALSE.
lower Lower bounds for the parameters (alpha, beta, gamma, phi)
upper Upper bounds for the parameters (alpha, beta, gamma, phi)
opt.crit Optimization criterion. One of "mse" (Mean Square Error), "amse" (Average
MSE over first nmse forecast horizons), "sigma" (Standard deviation of residu-
als), or "lik" (Log-likelihood, the default).
nmse Number of steps for average multistep MSE (1<=nmse<=10).
ets 9

bounds Type of parameter space to impose: "usual" indicates all parameters must
lie between specified lower and upper bounds; "admissible" indicates pa-
rameters must lie in the admissible space; "both" (default) takes the intersec-
tion of these regions.
ic Information criterion to be used in model selection.

Details

Based on the classification of methods as described in Hyndman et al (2008).


The methodology is fully automatic. The only required argument for ets is the time series. The
model is chosen automatically if not specified. This methodology performed extremely well on the
M3-competition data. (See Hyndman, et al, 2002, below.)

Value

An object of class "ets".


The generic accessor functions fitted.values and residuals extract useful features of the
value returned by ets and associated functions.

Author(s)

Rob J Hyndman

References

Hyndman, R.J., Koehler, A.B., Snyder, R.D., and Grose, S. (2002) "A state space framework for
automatic forecasting using exponential smoothing methods", International J. Forecasting, 18(3),
439454.
Hyndman, R.J., Akram, Md., and Archibald, B. (2007) "The admissible parameter space for expo-
nential smoothing models". Annals of Statistical Mathematics, to appear.
Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D. (2008) Forecasting with exponential
smoothing: the state space approach, Springer-Verlag. http://www.robhyndman.info/
expsmooth.

See Also

HoltWinters, rwf, arima.

Examples
fit <- ets(USAccDeaths)
plot(forecast(fit))
10 forecast.Arima

fitted.Arima One-step in-sample forecasts using ARIMA models

Description
Returns one-step forecasts for the data used in fitting the ARIMA model.

Usage
fitted.Arima(object,...)

Arguments
object An object of class "Arima". Usually the result of a call to arima.
... Other arguments.

Value
An time series of the one-step forecasts.

Author(s)
Rob J Hyndman

See Also
forecast.Arima.

Examples
fit <- arima(WWWusage,c(3,1,0))
plot(WWWusage)
lines(fitted(fit),col=2)

forecast.Arima Forecasting using ARIMA models

Description
Returns forecasts and other information for univariate ARIMA models.

Usage
## S3 method for class 'Arima':
forecast(object, h=ifelse(object$arma[5]>1,2*object$arma[5],10),
conf=c(80,95), fan=FALSE, xreg=NULL,...)
## S3 method for class 'ar':
forecast(object, h=10, conf=c(80,95), fan=FALSE, ...)
forecast.Arima 11

Arguments
object An object of class "Arima" or "ar". Usually the result of a call to arima or
ar.
h Number of periods for forecasting
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
xreg Future values of an regression variables (for class Arima objects only).
... Other arguments.

Details
This function calls predict.arima or predict.ar and constructs an object of class "forecast"
from the results.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by forecast.Arima.
An object of class "forecast" is a list containing at least the following elements:
model A list containing information about the fitted model
method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

See Also
predict.arima, predict.ar, rwf, arima.

Examples
fit <- arima(WWWusage,c(3,1,0))
plot(forecast(fit))
12 forecast.HoltWinters

forecast.HoltWinters
Forecasting using Holt-Winters objects

Description
Returns forecasts and other information for univariate Holt-Winters time series models.

Usage
## S3 method for class 'HoltWinters':
forecast(object, h=ifelse(frequency(object$x)>1,2*frequency(object$x),10),
conf=c(80,95),fan=FALSE,...)

Arguments
object An object of class "HoltWinters". Usually the result of a call to HoltWinters.
h Number of periods for forecasting
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
... Other arguments.

Details
This function calls predict.HoltWinters and constructs an object of class "forecast"
from the results.
It is included for completeness, but the ets is recommended for use instead of HoltWinters.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by forecast.HoltWinters.
An object of class "forecast" is a list containing at least the following elements:

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
forecast 13

x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

See Also
predict.HoltWinters, HoltWinters.

Examples
fit <- HoltWinters(WWWusage,gamma=0)
plot(forecast(fit))

forecast Forecasting time series

Description
forecast is a generic function for forecasting from time series or time series models. The func-
tion invokes particular methods which depend on the class of the first argument.
For example, the function forecast.Arima makes forecasts based on the results produced by
arima.
The function forecast.ts makes forecasts using exponential smoothing state space models.

Usage
forecast(...)
## S3 method for class 'ts':
forecast(x, h, conf=c(80,95), fan=FALSE, ...)

Arguments
x a time series or time series model for which forecasts are required
h Number of periods for forecasting
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
... Additional arguments affecting the forecasts produced. forecast.ts passes
these to forecast.ets
14 forecast.StructTS

Details
The default behaviour is to use a model estimated using ets.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract various useful features
of the value returned by forecast$model.
An object of class "forecast" is a list containing at least the following elements:
model A list containing information about the fitted model
method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

See Also
Other functions which return objects of class "forecast" are forecast.ets, forecast.Arima,
forecast.HoltWinters, forecast.StructTS, meanf, rwf, splinef, thetaf, croston,
ses, holt, hw.

forecast.StructTS Forecasting using Structural Time Series models

Description
Returns forecasts and other information for univariate structural time series models.

Usage
## S3 method for class 'StructTS':
forecast(object, h=ifelse(object$call$type=="BSM",2*object$xtsp[3],10),
conf=c(80,95), fan=FALSE, ...)
forecast.StructTS 15

Arguments
object An object of class "StructTS". Usually the result of a call to StructTS.
h Number of periods for forecasting
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
... Other arguments.

Details
This function calls predict.StructTS and constructs an object of class "forecast" from
the results.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by forecast.StructTS.
An object of class "forecast" is a list containing at least the following elements:
model A list containing information about the fitted model
method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

See Also
predict.StructTS, StructTS.

Examples
fit <- StructTS(WWWusage,"level")
plot(forecast(fit))
16 forecasterrors

forecasterrors Forecast errors

Description
Returns range of summary measures of the error x-f. These are (usually) out-of-sample forecast
errors. Compare gof which provides a summary of in-sample forecast errors. All measures are
defined and discussed in Hyndman and Koehler (2006).

Usage
forecasterrors(f, x, test=1:length(x))

Arguments
f Vector of univariate forecasts or object of class code"forecast".
x Vector of actual values of the same length as f.
test Indicator of which elements of x and f to test.

Value
Vector giving forecast error measures.

Author(s)
Rob J Hyndman

References
Hyndman, R.J. and Koehler, A.B. (2006) "Another look at measures of forecast accuracy". Inter-
national Journal of Forecasting, 22(4).

See Also
gof

Examples
fit1 <- rwf(EuStockMarkets[1:200,1],h=100)
fit2 <- meanf(EuStockMarkets[1:200,1],h=100)
forecasterrors(fit1,EuStockMarkets[201:300,1])
forecasterrors(fit2,EuStockMarkets[201:300,1])
plot(fit1)
lines(EuStockMarkets[1:300,1])
forecast.ets 17

forecast.ets Forecasting using ETS models

Description
Returns forecasts and other information for univariate ETS models.

Usage
## S3 method for class 'ets':
forecast(obj, h=ifelse(obj$m>1, 2*obj$m, 10), conf=c(80,95),
fan=FALSE, simulate=FALSE, bootstrap=FALSE, npaths=5000,...)

Arguments
obj An object of class "ets". Usually the result of a call to ets.
h Number of periods for forecasting
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
simulate If TRUE, prediction intervals produced by simulation rather than using analytic
formulae.
bootstrap If TRUE, simulation uses resampled errors rather than normally distributed er-
rors.
npaths Number of sample paths used in computing simulated prediction intervals.
... Other arguments.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by forecast.ets.
An object of class "forecast" is a list containing at least the following elements:
model A list containing information about the fitted model
method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)
18 plot.forecast

Author(s)
Rob J Hyndman

See Also
ets, ses, holt, hw.

Examples
fit <- ets(USAccDeaths)
plot(forecast(fit,h=48))

plot.forecast Forecast plot

Description
Plots a time series with forecasts and prediction intervals.

Usage
## S3 method for class 'forecast':
plot(x, include, plot.conf = TRUE, shaded = TRUE, shadecols
= switch(1 + (length(x$conf) > 1), 7, length(x$con
shadepalette=heat.colors(length(x$conf)+1)[-1], lambda = NULL,
col = 1, fcol = 4, ylim = NULL, main = NULL, ylab
## S3 method for class 'splineforecast':
plot(x,fitcol=2,...)

Arguments
x Forecast object produced by forecast.
include number of values from time series to include in plot
plot.conf Logical flag indicating whether to plot prediction intervals.
shaded Logical flag indicating whether prediction intervals should be shaded (TRUE)
or lines (FALSE)
shadecols Colors for shaded prediction intervals
shadepalette Palette for shaded prediction intervals
lambda Box-Cox parameter. If present, function backtransforms data and forecasts us-
ing InvBoxCox.
col the colour for the data line.
fcol the colour for the forecast line.
ylim Limits on y-axis
main Main title
gas 19

ylab Y-axis label


xlab X-axis label
fitcol Line colour for fitted values.
... additional arguments to plot.

Value
None.

Author(s)
Rob J Hyndman

References
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, Wiley:
New York.

See Also
plot.ts

Examples
deaths.fit <- hw(USAccDeaths,h=48)
plot(deaths.fit)

gas Australian monthly gas production

Description
Australian monthly gas production: 19561995.

Usage
gas

Format
Time series data

Source
Australian Bureau of Statistics.
20 gof

Examples
plot(gas)
seasonplot(gas)
tsdisplay(gas)

gof Goodness-of-fit for forecast model

Description

Returns range of summary measures of the in-sample errors. Compare forecasterrors which
provides a summary of out-of-sample forecast errors. All measures are defined and discussed in
Hyndman and Koehler (2006).

Usage

gof(object)

Arguments

object An object of class "forecast"

Value

Vector giving in-sample error measures.

Author(s)

Rob J Hyndman

References

Hyndman, R.J. and Koehler, A.B. (2006) "Another look at measures of forecast accuracy". Inter-
national Journal of Forecasting, 22(4).

Examples
fit1 <- rwf(Nile)
fit2 <- meanf(Nile)
gof(fit1)
gof(fit2)
gold 21

gold Daily morning gold prices

Description
Daily morning gold prices in US dollars. 1 January 1985 31 March 1989.

Usage
data(gold)

Format
Time series data

Source
Time Series Data Library. http://www-personal.buseco.monash.edu.au/~hyndman/
TSDL/

Examples
tsdisplay(gold)

meanf Mean Forecast

Description
Returns forecasts and prediction intervals for an iid model applied to x.

Usage
meanf(x, h=10, conf=c(80,95), fan=FALSE)

Arguments
x a numeric vector or time series
h Number of periods for forecasting
conf Confidence levels for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
22 meanf

Details
The iid model is
Yt = + Zt
where Zt is a normal iid error. Forecasts are given by

Yn (h) =

where is estimated by the sample mean.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by meanf.
An object of class "forecast" is a list containing at least the following elements:

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

See Also
rwf

Examples
nile.fcast <- meanf(Nile, h=10)
plot(nile.fcast)
monthdays 23

monthdays Number of days in each season

Description
Returns number of days in each month or quarter of the observed time period.

Usage
monthdays(x)

Arguments
x time series

Details
Useful for month length adjustments

Value
Time series

Author(s)
Rob J Hyndman

Examples
par(mfrow=c(2,1))
plot(ldeaths,xlab="Year",ylab="pounds",
main="Monthly deaths from lung disease (UK)")
ldeaths.adj <- ldeaths/monthdays(ldeaths)*365.25/12
plot(ldeaths.adj,xlab="Year",ylab="pounds",
main="Adjusted monthly deaths from lung disease (UK)")

na.interp Interpolate missing values in a time series

Description
Uses linear interpolation to replace missing values.

Usage
na.interp(x)
24 ndiffs

Arguments
x time series

Details

Value
Time series

Author(s)
Rob J Hyndman

Examples
data(gold)
plot(na.interp(gold))

ndiffs Number of differences

Description
Uses a KPSS test for the null hypothesis that x has a stationary root against a unit-root alternative.
Returns the least number of differences required to pass the test at the level alpha.

Usage
ndiffs(x,alpha=0.05)

Arguments
x A univariate time series
alpha Level of the test

Value
An integer.

Author(s)
Rob J Hyndman

See Also
kpss.test
plot.ets 25

Examples

ndiffs(WWWusage)

plot.ets Plot components from ETS model

Description

Produces a plot of the level, slope and seasonal components from an ETS model.

Usage

## S3 method for class 'ets':


plot(x, ...)

Arguments

x Object of class ets.


... Other plotting parameters passed to par.

Value

None. Function produces a plot

Author(s)

Rob J Hyndman

See Also

ets

Examples

fit <- ets(USAccDeaths)


plot(fit)
plot(fit,plot.type="single",ylab="",col=1:3)
26 rwf

rwf Random Walk Forecast

Description
Returns forecasts and prediction intervals for a random walk with drift model applied to x.

Usage
rwf(x, h=10, drift=FALSE, conf=c(80,95), fan=FALSE)

Arguments
x a numeric vector or time series
h Number of periods for forecasting
drift Logical flag. If TRUE, fits a random walk with drift model.
conf Confidence levels for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.

Details
The random walk with drift model is

Yt = c + Yt1 + Zt

where Zt is a normal iid error. Forecasts are given by

Yn (h) = ch + Yn

. If there is no drift, the drift parameter c=0. Forecast standard errors allow for uncertainty in
estimating the drift parameter.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by rwf.
An object of class "forecast" is a list containing at least the following elements:

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
seasadj 27

upper Upper limits for prediction intervals


conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

See Also
arima, meanf

Examples
gold.fcast <- rwf(gold[1:60],h=50)
plot(gold.fcast)

seasadj Seasonal adjustment

Description
Returns seasonally adjusted data constructed by removing the seasonal component.

Usage
seasadj(object)

Arguments
object Object created by decompose or stl.

Value
Univariate time series.

Author(s)
Rob J Hyndman

See Also
stl, decompose
28 seasonaldummy

Examples
plot(AirPassengers)
lines(seasadj(decompose(AirPassengers,"multiplicative")),col=4)

seasonaldummy Seasonal dummy variables

Description

Returns matrix of dummy variables suitable for use in arima, lm or arima.predict. The last
season is omitted and used as the control.

Usage

seasonaldummy(x)
seasonaldummyf(x,h)

Arguments

x Seasonal time series


h Number of periods ahead to forecast

Value

Numerical matrix with number of rows equal to the length(x) and number of columns equal to
frequency(x)-1.

Author(s)

Rob J Hyndman

Examples
plot(ldeaths)
plot(ldeaths)
month <- seasonaldummy(ldeaths)
deaths.lm <- lm(ldeaths ~ month)
tsdisplay(residuals(deaths.lm))
ldeaths.fcast <- predict(deaths.lm,
data.frame(month=I(seasonaldummyf(ldeaths,36))),
se.fit=TRUE)
seasonplot 29

seasonplot Seasonal plot

Description
Plots a seasonal plot as described in Makridakis, Wheelwright and Hyndman (1998, chapter 2).

Usage
seasonplot(x, s, season.labels = NULL, year.labels = FALSE,
year.labels.left = FALSE, type = "o", main, ylab = "",
xlab = NULL, col = 1, ...)

Arguments
x a numeric vector or time series.
s seasonal frequency of x
season.labels
Labels for each season in the "year"
year.labels Logical flag indicating whether labels for each year of data should be plotted on
the right.
year.labels.left
Logical flag indicating whether labels for each year of data should be plotted on
the left.
type plot type (as for plot)
main Main title.
ylab Y-axis label
xlab X-axis label
col Colour
... additional arguments to plot.

Value
None.

Author(s)
Rob J Hyndman

References
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, Wiley:
New York.
30 ses

See Also
monthplot

Examples
seasonplot(AirPassengers)

ses Exponential smoothing forecasts

Description
Returns forecasts and other information for exponential smoothing forecasts applied to x.

Usage
ses(x, h=10, conf=c(80,95), fan=FALSE, ...)

holt(x, h=10, damped=FALSE, conf=c(80,95), fan=FALSE, ...)

hw(x, h=2*frequency(x), seasonal="additive", damped=FALSE, conf=c(80,95), fan=FALSE

Arguments
x a numeric vector or time series
h Number of periods for forecasting.
damped If TRUE, use a damped trend.
seasonal Type of seasonality in hw model. "additive" or "multiplicative"
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.
... Other arguments passed to ets.

Details
ses, holt and hw are simply convenient wrapper functions for forecast(ets(...)).

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by ets and associated functions.
An object of class "forecast" is a list containing at least the following elements:
simulate.ets 31

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)
Rob J Hyndman

References
Hyndman, R.J., Koehler, A.B., Snyder, R.D., Grose, S. (2002) "A state space framework for auto-
matic forecasting using exponential smoothing methods", International J. Forecasting, 18(3), 439
454.
Hyndman, R.J., Akram, Md., and Archibald, B. (2003) "The admissible parameter space for expo-
nential smoothing models". Working paper, Department of Econometrics and Business Statistics,
Monash University.

See Also
ets, HoltWinters, rwf, arima.

Examples
fcast <- holt(airmiles)
plot(fcast)
deaths.fcast <- hw(USAccDeaths,h=48)
plot(deaths.fcast)

simulate.ets Simulation from an ETS model

Description
Returns a time series based on the model object object.

Usage
simulate.ets(object, nsim=length(object$x), seed=NULL, initstate=object$state[1,],
32 sindexf

Arguments
object An object of class "ets". Usually the result of a call to ets.
nsim Number of periods for the simulated series
seed Either NULL or an integer that will be used in a call to set.seed before
simulating the time seriers. The default, NULL will not change the random
generator state.
initstate State at time 0.
bootstrap If TRUE, simulation uses resampled errors rather than normally distributed er-
rors.
... Other arguments.

Value
An object of class "ts".

Author(s)
Rob J Hyndman

See Also
ets

Examples
fit <- ets(USAccDeaths)
plot(simulate(fit, 100))

sindexf Forecast seasonal index

Description
Returns vector containing the seasonal index for h future periods. If the seasonal index is non-
periodic, it uses the last values of the index.

Usage
sindexf(object, h)

Arguments
object Output from decompose or stl.
h Number of periods ahead to forecast
splinef 33

Value
Time series

Author(s)
Rob J Hyndman

Examples
uk.stl <- stl(UKDriverDeaths,"periodic")
uk.sa <- seasadj(uk.stl)
uk.fcast <- holt(uk.sa,36)
seasf <- sindexf(uk.stl,36)
uk.fcast$mean <- uk.fcast$mean + seasf
uk.fcast$lower <- uk.fcast$lower + cbind(seasf,seasf)
uk.fcast$upper <- uk.fcast$upper + cbind(seasf,seasf)
uk.fcast$x <- UKDriverDeaths
plot(uk.fcast,main="Forecasts from Holt's method with seasonal adjustment")

splinef Cubic Spline Forecast

Description
Returns local linear forecasts and prediction intervals using cubic smoothing splines.

Usage
splinef(x, h=10, conf=c(80,95), fan=FALSE)

Arguments
x a numeric vector or time series
h Number of periods for forecasting
conf Confidence level for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.

Details
The cubic smoothing spline model is equivalent to an ARIMA(0,2,2) model but with a restricted
parameter space. The advantage of the spline model over the full ARIMA model is that it provides
a smooth historical trend as well as a linear forecast function. Hyndman, King, Pitrun, and Bil-
lah (2002) show that the forecast performance of the method is hardly affected by the restricted
parameter space.
34 splinef

Value

An object of class "forecast".


The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by meanf.
An object of class "forecast" is a list containing at least the following elements:

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)

Author(s)

Rob J Hyndman

References

Hyndman, King, Pitrun and Billah (2002) Local linear forecasts using cubic smoothing splines.
Working paper available at http://www-personal.buseco.monash.edu.au/~hyndman/
papers/splinefcast.htm.

See Also

smooth.spline, arima, holt.

Examples
fcast <- splinef(uspop,h=5)
plot(fcast)
summary(fcast)
thetaf 35

thetaf Theta method forecast

Description
Returns forecasts and prediction intervals for a theta method forecast.

Usage
thetaf(x, h=10, conf=c(80,95), fan=FALSE)

Arguments
x a numeric vector or time series
h Number of periods for forecasting
conf Confidence levels for prediction intervals.
fan If TRUE, conf is set to seq(50,99,by=1). This is suitable for fan plots.

Details
The theta method of Assimakopoulos and Nikolopoulos (2000) is equivalent to simple exponential
smoothing with drift. This is demonstrated in Hyndman and Billah (2003). Prediction intervals are
computed using the underlying state space model.

Value
An object of class "forecast".
The function summary is used to obtain and print a summary of the results, while the function
plot produces a plot of the forecasts and prediction intervals.
The generic accessor functions fitted.values and residuals extract useful features of the
value returned by rwf.
An object of class "forecast" is a list containing at least the following elements:

model A list containing information about the fitted model


method The name of the forecasting method as a character string
mean Point forecasts as a time series
lower Lower limits for prediction intervals
upper Upper limits for prediction intervals
conf The confidence values associated with the prediction intervals
x The original time series (either object itself or the time series used to create
the model stored as object).
residuals Residuals from the fitted model. That is x minus fitted values.
fitted Fitted values (one-step forecasts)
36 tsdisplay

Author(s)
Rob J Hyndman

References
Assimakopoulos, V. and Nikolopoulos, K. (2000). The theta model: a decomposition approach to
forecasting. International Journal of Forecasting 16, 521-530.
Hyndman, R.J., and Billah, B. (2003) Unmasking the Theta method. International J. Forecasting,
19, 287-290.

See Also
arima, meanf, rwf, ses

Examples
nile.fcast <- thetaf(Nile)
plot(nile.fcast)

tsdisplay Time series display

Description
Plots a time series along with its acf and either its pacf, lagged scatterplot or spectrum.

Usage
tsdisplay(x, plot.type = "partial", points = TRUE, ci.type =
"white", lag.max = round(10 * log10(length(x))),
na.action = na.interp, main = NULL, ylab = "", xlab =
"", pch = 1, cex = 0.5, ...)

Arguments
x a numeric vector or time series.
plot.type type of plot to include in lower right corner. Possible values are "partial", "scat-
ter" or "spectrum".
points logical flag indicating whether to show the individual points or not in the time
plot.
ci.type type of confidence limits for ACF. Possible values are as for acf.
lag.max the maximum lag to plot for the acf and pacf.
na.action how to handle missing values. Default is to use linear interpolation.
main Main title.
ylab Y-axis label
wineind 37

xlab X-axis label


pch Plotting character
cex Character size
... additional arguments to acf.

Value
None.

Author(s)
Rob J Hyndman

References
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, Wiley:
New York.

See Also
plot.ts, acf

Examples
tsdisplay(diff(WWWusage))

wineind Australian total wine sales

Description
Australian total wine sales by wine makers in bottles <= 1 litre. Jan 1980 Aug 1994.

Usage
wineind

Format
Time series data

Source
Time Series Data Library. http://www-personal.buseco.monash.edu.au/~hyndman/
TSDL/

Examples
tsdisplay(wineind)
38 woolyrnq

woolyrnq Quarterly production of woollen yarn in Australia

Description
Quarterly production of woollen yarn in Australia: tonnes. Mar 1965 Sep 1994.

Usage
woolyrnq

Format
Time series data

Source
Time Series Data Library. http://www-personal.buseco.monash.edu.au/~hyndman/
TSDL/

Examples
tsdisplay(woolyrnq)
Package fma

Title Data sets from Forecasting: methods and applications by Makridakis, Wheelwright &
Hyndman (1998)

Description All data sets from Forecasting: methods and applications by Makridakis, Wheelwright
& Hyndman (Wiley, 3rd ed., 1998).

advert Sales and advertising expenditure

Description
Monthly sales and advertising expenditure for an automotive parts company.

Usage
advert

Format
Data frame containing the following columns:

advert Monthly Advertising expenditure


sales Monthly sales volume

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 6.7. Exercise 8.1.

Examples
plot(sales ~ advert, data=advert)

39
40 airpass

advsales Sales volume and advertising expenditure

Description
Sales volume and advertising expenditure for a dietary weight control product.

Usage
advsales

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 8.

References
Blattberg and Jeuland (1981).

Examples
plot(advsales)

airpass Monthly Airline Passenger Numbers 1949-1960

Description
The classic Box & Jenkins airline data. Monthly totals of international airline passengers (1949
1956).

Usage
airpass

Format
A monthly time series, in thousands.
auto 41

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.4, Chapter 3, Exercise 4.7.

References
Box, Jenkins and Reinsell (1994) Time series analysis: forecasting and control, 3rd edition, Holden-
Day: San Francisco. Series G.

Examples
plot(airpass)
seasonplot(airpass)
tsdisplay(airpass)

auto Attributes of some US and Japanese automobiles

Description
Price, mileage, age and country of origin for 45 automobiles.

Usage
auto

Format
This data frame contains the following columns:
Model Name of model
Country Country of manufacture
Mileage Mileage per gallon
Price Price of car at time of measurement

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, Wiley:
New York. Chapter 2.

References
Consumer Reports, April 1990, pp.235-255.

Examples
plot(Price ~ Mileage, data=auto,pch=19,col=2)
points(auto$Mileage[auto$Country=="USA"],auto$Price[auto$Country=="USA"],pch=19,col=4)
legend(30,25000,legend=c("USA","Japan"),pch=19,col=c(4,2))
42 beer

bank Mutual savings bank deposits

Description
Deposits in a mutual savings bank in a large metropolitan area.

Usage
bank

Format
Data frame containing the following columns:
EOM End of month balance
AAA Composite AAA bond rates
threefour US Government 3-4 year bonds

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 6.

Examples
plot(bank)

beer Monthly beer production

Description
Monthly Australian beer production: Jan 1991 Aug 1995.

Usage
beer

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 2.
bicoal 43

Examples
plot(beer)
seasonplot(beer)
tsdisplay(beer)

bicoal Annual bituminous coal production

Description
Annual bituminous coal production in the USA: 19201968.

Usage
bicoal

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.7.

Examples
tsdisplay(bicoal)

books Sales of paperback and hardcover books

Description
Daily sales of paperback and hardcover books at the same store.

Usage
books

Format
Bivariate time series containing the following columns:
Paperback Number of paperback sales each day
Hardcover Number of hardcover sales each day
44 boston

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 4.5.

Examples
plot(books)

boston Monthly dollar volume of sales

Description

Monthly dollar volume of sales on Boston stock exchange and combined New York and American
stock exchange. January 1967 November 1969.

Usage

boston

Format

Bivariate time series containing the following columns:

nyase New York and American Stock Exchange dollar volume


bse Boston Stock Exchange dollar volume

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 6.5

References

McGee and Carleton (1970) Piecewise regression, Journal of the American Statistical Association,
65, 11091124.

Examples
plot(boston)
bricksq 45

bricksq Quarterly clay brick production

Description
Australian quarterly clay brick production: 19561994.

Usage
bricksq

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 1 and Exercise 2.3.

Examples
plot(bricksq)
seasonplot(bricksq)
tsdisplay(bricksq)

canadian Canadian unemployment rate

Description
Canadian unemployment rate as a percentage of the civilian labor force between 1974 and the third
quarter of 1975.

Usage
canadian

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 4.1.
46 cement

Examples
plot(canadian)

capital Quarterly capital expenditure and appropriations

Description
Seasonally adjusted quarterly capital expenditure and appropriations in U.S. manufacturing: 1953
1974.

Usage
capital

Format
Bivariate time series containing the following columns:

capital Quarterly capital expenditure for US manufacturing.


appropriations Quarterly capital appropriations for US manufacturing.

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 8.

Examples
plot(capital)

cement Cement composition and heat data

Description
Cement composition and heat data.

Usage
cement
chicken 47

Format

Data frame containing the following columns:

pc1 Percentage by weight of component 1


pc2 Percentage by weight of component 2
pc3 Percentage by weight of component 3
heat Heat emitted in calories per gram of cement.

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 6.4

Examples
plot(cement)

chicken Price of chicken

Description

Price of chicken in US (constant dollars): 19241993.

Usage

chicken

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(chicken)
48 copper

condmilk Condensed milk

Description
Manufacturers Stocks of evaporated and sweetened condensed milk.

Usage
condmilk

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.5.

Examples
plot(condmilk)
seasonplot(condmilk)
tsdisplay(condmilk)

copper Copper price

Description
Yearly copper prices, 18001997 (in constant 1997 dollars).

Usage
copper

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(copper)
copper1 49

copper1 Copper prices

Description
Monthly copper prices for 28 consecutive months (in constant 1997 dollars).

Usage
copper1

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(copper1)

copper2 Copper prices

Description
Yearly copper prices for 14 consecutive years (in constant 1997 dollars).

Usage
copper2

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(copper2)
50 cowtemp

copper3 Copper prices

Description
Yearly copper prices for 43 consecutive years (in constant 1997 dollars).

Usage
copper3

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(copper3)

cowtemp Temperature of a cow

Description
Daily morning temperature of a cow. Measure at 6.30am for 75 consecutive mornings by counting
chirps from a telemetric thermometer implanted in the cow. Data are chirps per 5-minute interval
minus 800.

Usage
cowtemp

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercises 2.3 and 2.4.
cpimel 51

References
Velleman, Paul. (1981) The ABC of EDA, Duxbury Press.

Examples
plot(cowtemp)
tsdisplay(cowtemp)

cpimel Consumer price index

Description
Quarterly CPI (consumer price index) for Victoria: Q1 1980 to Q2 1995.

Usage
cpimel

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 8.7.

Examples
tsdisplay(cpimel)

dexter Dexterity test and production ratings

Description
Scores on manual dexterity test and production ratings for 20 workers.

Usage
dexter
52 dj

Format
Data frame containing the following columns:

score Test score for manual dexterity


production Production rating

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.4

Examples
plot(production~score,data=dexter,pch=19,col=3)

dj Dow-Jones index

Description
Dow-Jones index on 251 trading days ending 26 Aug 1994.

Usage
dj

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 7.

References
Brockwell and Davis (1996)

Examples
tsdisplay(dj)
dole 53

dole Unemployment benefits in Australia

Description
Monthly total of people on unemployment benefits in Australia (Jan 1965 Jul 1992).

Usage
dole

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.3.

Examples
plot(dole)
tsdisplay(dole)

dowjones Dow-Jones index

Description
Dow-Jones index, 28 Aug - 18 Dec 1972.

Usage
dowjones

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.7.

Examples
tsdisplay(dowjones)
54 eggs

econsumption Electricity consumption and temperature

Description
Electricity consumption and maximum temperature for 12 randomly chosen days.

Usage
temperature

Format
Data frame containing the following columns:

Mwh Daily electricity consumption (megawatt-hours)


temp Daily maximum temperature (degrees Celsius)

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.5

Examples
plot(Mwh ~ temp, data=econsumption,pch=19,col=4)

eggs Price of eggs

Description
Price of dozen eggs in US, 19001993, in constant dollars.

Usage
eggs

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.
eknives 55

Examples
plot(eggs)

eknives Sales of electric knives

Description
Sales of electric knives: Jan 1991 - April 1992.

Usage
eknives

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 4.2.

Examples
plot(eknives)

elco Sales of Elcos laser printers

Description
Sales of Elcos laser printers: 19921998.

Usage
elco

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 10.
56 expenditure

Examples
plot(elco)

elec Electricity production

Description
Australian monthly electricity production: Jan 1956 Aug 1995.

Usage
elec

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapters 12, 7.

Examples
plot(elec)
seasonplot(elec)
tsdisplay(elec)

expenditure Expenditure

Description
Expenditure for 12 supermarket customers.

Usage
expenditure

Format
Time series data
fancy 57

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 2.

Examples
hist(expenditure)

fancy Sales for a souvenir shop

Description
Monthly sales for a souvenir shop on the wharf at a beach resort town in Queensland, Australia.

Usage
fancy

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.8.

Examples
plot(fancy)
seasonplot(fancy)

french Industry index

Description
French index of industry.

Usage
french

Format
Time series data
58 housing

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 4.4.

Examples
plot(french)

housing Housing data

Description

Monthly housing starts, construction contracts and average new home mortgage rates (Jan 1983 -
Oct 1989).

Usage

housing

Format

Trivariate time series containing the following columns:

hstarts Monthly housing starts (thousands of units)


construction Construction contracts (millions of dollars)
interest Average new home mortgage rates

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 8.

References

Survey of current business, US Department of Commerce, 1990.

Examples
plot(housing)
hsales 59

hsales Sales of one-family houses

Description
Monthly sales of new one-family houses sold in the USA since 1973.

Usage
hsales

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 3.

References
US Census Bureau, Manufacturing and Construction Division

Examples
plot(hsales)
plot(stl(hsales,"periodic"),main="Sales of new one-family houses, USA")

hsales2 Sales of new one-family houses

Description
Sales of new one-family houses in the USA (Jan 1987 Nov 1995).

Usage
hsales2

Format
Time series data
60 ibm

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.10.

Examples
plot(hsales2)
seasonplot(hsales2)
tsdisplay(hsales2)

huron Level of Lake Huron

Description
Level of Lake Huron in feet (reduced by 570 feet): 18751972.

Usage
huron

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 8.2.

Examples
plot(huron)

ibm IBM sales and profit

Description
IBM sales and profit (1954-1984) and forecasts.

Usage
ibm
ibmclose 61

Format
Time series data

Sales IBM annual sales


Profit IBM annual profit
FSales Forecast of IBM sales made in 1984
FProfit Forecast of IBM profits made in 1984

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
par(mfrow=c(2,1))
plot(ibm[,1],xlim=c(1954,2000),ylim=c(0,200),
ylab="Sales (billions of $)",xlab="Year",type="o")
lines(ibm[,3],col=2,type="o")
plot(ibm[,2],xlim=c(1954,2000),ylim=c(-10,30),
ylab="Profits (billions of $)",xlab="Year",type="o")
lines(ibm[,4],col=2,type="o")

ibmclose Closing IBM stock price

Description
Daily closing IBM stock price.

Usage
ibmclose

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.2.

References
Box, Jenkins and Reinsell (1994) Time series analysis: forecasting and control, 3rd edition, Holden-
Day: San Francisco.
62 internet

Examples
tsdisplay(ibmclose)

input Input series

Description
Input series for exercise 8.6.

Usage
input

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 8.6.

Examples
plot(input)

internet Number of internet users

Description
Number of users logged on to an internet server each minute over a 100-minute period.

Usage
internet

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 7.
invent15 63

Examples
tsdisplay(internet)

invent15 Inventory demand

Description
Inventory demand for product E15.

Usage
invent15

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.6. Also Chapter 4.

Examples
plot(invent15)

jcars Motor vehicle production

Description
Japanese motor vehicle production in thousand (19471989).

Usage
jcars

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.8. Chapter 8.
64 kkong

References

World motor vehicle data, Motor Vehicle Manufacturers of US Inc, Detroit, 1991.

Examples

plot(jcars)
log.jcars <- BoxCox(jcars,0)
jcars.f <- holt(log.jcars)
plot(jcars.f)

kkong King Kong data

Description

King Kong data.

Usage

kkong

Format

Data frame consisting of following columns

weight Weights of 21 gorillas


height Heights of 21 gorillas

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 5. Exercise 5.6.

Examples

plot(weight~height,data=kkong,pch=19,col=2)
labour 65

labour Civilian labour force

Description
Number of persons in the civilian labour force in Australia each month (Feb 1978 - Aug 1995).

Usage
labour

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 3.8.

Examples
plot(labour)
labour.stl <- stl(labour,10)
plot(labour.stl)
monthplot(labour.stl$time.series[,1],type="h")

lynx Annual Canadian Lynx trappings 18211934

Description
Annual number of lynx trapped in McKenzie river district of northwest Canada: 18211934.

Usage
lynx

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.3.
66 milk

References

Campbell, M. J.and A. M. Walker (1977). A Survey of statistical work on the Mackenzie River
series of annual Canadian lynx trappings for the years 18211934 and a new analysis. Journal of
the Royal Statistical Society series A, 140, 411431.

Examples
plot(lynx)
tsdisplay(lynx)

milk Monthly milk production per cow

Description

Average monthly milk production per cow over 14 years.

Usage

milk

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 2.

References

Cryer (1986) Time series analysis, Duxbury Press: Belmont.

Examples
par(mfrow=c(2,1))
plot(milk,xlab="Year",ylab="pounds",
main="Monthly milk production per cow")
milk.adj <- milk/monthdays(milk)*365.25/12
plot(milk.adj,xlab="Year",ylab="pounds",
main="Adjusted monthly milk production per cow")
mink 67

mink Number of minks trapped

Description
Annual number of minks trapped in McKenzie river district of northwest Canada: 18481911.

Usage
mink

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.4.

Examples
tsdisplay(mink)

mortal Mortality

Description
Bird mortality for 156 poultry farms, Aug 1995 - Jul 1996.

Usage
mortal

Format
Data frame containing the following columns:

typeA Percentage of Type A birds for each farm.


mortality Percentage mortality of all birds for each farm.

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.9
68 motion

Examples
plot(mortality~typeA,data=mortal)

motel Total accommodation at hotel, motel and guest house

Description
Total room nights occupied and total monthly takings from accommodation at hotel, motel and
guest house in Victoria, Australia: Jan 1980 - June 1995.

Usage
motel

Format
Trivariate time series containing the following columns:
Roomnights Total room nights
Takings Total monthly takings (thousands of dollars)
CPI Quarterly CPI values

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 8.7.

Examples
plot(motel[,2],motel[,1], xlab="Room nights", ylab="Takings",pch=19,col=4)

motion Employment figures in the motion picture industry

Description
Monthly employment figures for the motion picture industry (SIC Code 78): Jan 1955 Dec 1970.

Usage
motion

Format
Time series data
nail 69

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.9.

References

"Employment and earnings, US 19091978", Department of Labor, 1979.

Examples

plot(motion)
seasonplot(motion)
tsdisplay(motion)

nail Nail prices

Description

Nail prices, 18001996 in constant dollars.

Usage

nail

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples

plot(nail)
70 olympic

oilprice Oil prices

Description
Oil prices in constant 1997 dollars: 18701997.

Usage
oilprice

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 10.

Examples
plot(oilprice)

olympic Mens 400 m final winning times in each Olympic Games

Description
Winning times for the mens 400 m final in each Olympic Games: 18961996.

Usage
olympic

Format
Data frame containing the following columns:

Year Year of Olympics


time Winning time in 400m final

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.7
ozone 71

Examples
plot(time~Year,data=olympic,pch=19,col=3)

ozone Ozone depletion and melanoma rates

Description
Ozone depletion and melanoma rates in various locations.

Usage
ozone

Format
Data frame containing the following columns:

ozonedep Ozone depletion rates as percentages


melanoma Melanoma rates as percentages

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.3.

Examples
plot(ozonedep~melanoma,data=ozone,pch=19,col=2)

paris Average temperature

Description
Average monthly temperature in Paris.

Usage
paris

Format
Time series data
72 pcv

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.1.

Examples

plot(paris)
seasonplot(paris)
tsdisplay(paris)

pcv GDP

Description

GDP for Western Europe and PCV industry sales.

Usage

pcv

Format

Bivariate time series consisting of the following columns

GDP GDP Western Europe


PCV PCV Industry sales

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 5.

Examples

plot(PCV~GDP,data=pcv,pch=20,col=2)
petrol 73

petrol Sales of petroleum and related product

Description
US monthly sales of petroleum and related product: Jan 1971 - Dec 1991.

Usage
petrol

Format
Multivariate time series data:

Chemicals Sales of chemicals and allied products


Coal Sales of Bituminous coal products
Petrol Sales of petroleum and coal products
Vehicles Sales of motor vehicles and parts

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 8.

Examples
plot(petrol)

pigs Number of pigs slaughtered

Description
Monthly total number of pigs slaughtered in Victoria, Australia (Jan 1980 Aug 1995).

Usage
pigs

Format
Time series data
74 pollution

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 7.

Examples
tsdisplay(pigs)

plastics Sales of plastic product

Description
Monthly sales of product A for a plastics manufacturer.

Usage
plastics

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 3.5.

Examples
plot(plastics)
seasonplot(plastics)
plot(stl(plastics,"periodic"))

pollution Shipment of pollution equipment

Description
Monthly shipments of pollution equipment (in thousands of French francs), Jan 1986 Oct 1996.

Usage
pollution
productC 75

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 7.

Examples

tsdisplay(pollution)

productC Sales of product C

Description

Sales of product C (a lubricant sold in large containers).

Usage

productC

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 1.

Examples

plot(productC)
76 qelec

pulpprice Pulp price and shipments

Description
World pulp price and shipments.

Usage
pulpprice

Format
Data frame consisting of following columns

shipments World pulp shipments


price World pulp price

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 5.

Examples
plot(shipments~price,data=pulpprice)

qelec Electricity production

Description
Quarterly electricity production.

Usage
qelec

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 3.4.
qsales 77

Examples
plot(decompose(qelec))

qsales Sales data

Description
Quarterly exports of a French company in thousands of francs.

Usage
qsales

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 3.7 and Table 4-7.

Examples
plot(qsales)

running Running times and maximal aerobic capacity

Description
Running times and maximal aerobic capacity for 14 female runners.

Usage
running

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 2.5.
78 schizo

References
Conley, Krahenbuhl, Burkett and Millar (1981) Physiological correlates of female road racing per-
formance, Research Quarterly Exercise Sport, 52, 441448.

Examples
plot(times~capacity,data=running,pch=19,col=2)

sales Sales data

Description
Sales data over 10 time periods.

Usage
sales

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 5.

Examples
plot(sales,type="p")
abline(lsfit(1:10,sales))

schizo Perceptual speed scores

Description
Daily perceptual speed scores for a schizophrenic patient. The patient began receiving a powerful
tranquilizer (chlorpromzaine) on the 61st day and continued receiving the drug for the remainder of
the sample period. It is expected that this drug would reduce perceptual speed.

Usage
schizo
shampoo 79

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 8.8.

References

McCleary and Hay (1980).

Examples
plot(schizo)

shampoo Sales of shampoo

Description

Sales of shampoo over a three year period.

Usage

shampoo

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 3.

Examples
plot(shampoo)
80 ship

sheep Sheep population

Description
Sheep population (in millions) of England and Wales: 18671939.

Usage
sheep

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.6.

References
Kendall (1976).

Examples
tsdisplay(sheep)

ship Electric can opener shipments

Description
Electric can opener shipments.

Usage
ship

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 4. Exercise 4.6.
shipex 81

Examples
plot(ship)

shipex Shipments

Description
Shipments

Usage
shipex

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 3.1

Examples
plot(shipex)

strikes Number of strikes

Description
Number of strikes in the US from 1951 to 1980.

Usage
strikes

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.4
82 texasgas

References
Brockwell and Davis (1991)

Examples
tsdisplay(strikes)

telephone Telephone cost

Description
Telephone cost in San Francisco, New York: 19151996.

Usage
telephone

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(telephone)

texasgas Price and consumption of natural gas

Description
Price and per capita consumption of natural gas in 20 towns in Texas.

Usage
texasgas

Format
Data frame containing the following columns:
price Average price in cents per thousand cubic feet
consumption Consumption per customer in thousand cubic feet.
ukdeaths 83

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 5.10. Exercise 6.2.

Examples

plot(consumption ~ price, data=texasgas)

ukdeaths Total deaths and serious injuries

Description

Monthly total deaths and serious injuries on UK roads: Jan 1975 Dec 1984. In February 1983,
new legislation came into force requiring seat belts to be worn.

Usage

ukdeaths

Format

Time series data

Source

Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 8.

References

Harvey (1989)

Examples

plot(ukdeaths)
seasonplot(ukdeaths)
tsdisplay(ukdeaths)
84 uselec

usdeaths Accidental deaths in USA

Description
Monthly accidental deaths in USA.

Usage
usdeaths

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercises 2.3 and 2.4.

Examples
plot(usdeaths)
seasonplot(usdeaths)
tsdisplay(usdeaths)

uselec Total generation of electricity

Description
Monthly total generation of electricity by the U.S. electric industry (Jan 1985 - Oct 1996.

Usage
uselec

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.8.
ustreas 85

Examples
plot(uselec)
seasonplot(uselec)
tsdisplay(uselec)

ustreas Treasury bill contracts

Description
US treasury bill contracts on the Chicago market for 100 consecutive trading days in 1981.

Usage
ustreas

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 1.

Examples
plot(ustreas)
tsdisplay(ustreas)

wagesuk Real daily wages

Description
Real daily wages in pound, England: 12601994.

Usage
wagesuk

Format
Time series data
86 wn

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(wagesuk)

wheat Wheat prices

Description
Wheat prices in constant 1996 pounds: 12641996.

Usage
wheat

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 9.

Examples
plot(wheat)

wn White noise series

Description
White noise series.

Usage
wn

Format
Time series data
wnoise 87

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Exercise 7.3.

Examples
tsdisplay(wn)

wnoise White noise time series

Description
White noise time series with 36 values.

Usage
wnoise

Format
Time series data

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chpater 7.

Examples
tsdisplay(wnoise)

writing Sales of printing and writing paper

Description
Industry sales for printing and writing paper (in thousands of French francs): Jan 1963 Dec 1972.

Usage
writing

Format
Time series data
88 writing

Source
Makridakis, Wheelwright and Hyndman (1998) Forecasting: methods and applications, John Wiley
& Sons: New York. Chapter 7.

Examples
tsdisplay(writing)
seasonplot(writing)
Package Mcomp

Title Data from the M-competitions


Description The 1001 time series from the M-competition (Makridakis et al. 1982) and the 3003 time
series from the IJF-M3 competition (Makridakis and Hibon, 2000).

M1 M-Competition data

Description
The time series from the M1 and M3 forecasting competitions.

Usage
data(M1)
data(M3)

Format
M1 is a list of 1001 series and M3 is a list of 3003 series. Each list is of class Mcomp. Each series
within M1 and M3 is of class Mdata with the following structure:
sn Name of the series
st Series number and period. For example "Y1" denotes first yearly series, "Q20" denotes 20th
quarterly series and so on.
n The number of observations in the time series
h The number of required forecasts
period Interval of the time series. Possible values are "YEARLY", "QUARTERLY", "MONTHLY"
& "OTHER".
type The type of series. Possible values for M1 are "DEMOGR", "INDUST", "MACRO1", "MACRO2",
"MICRO1", "MICRO2" & "MICRO3". Possible values for M3 are "DEMOGRAPHIC", "FI-
NANCE", "INDUSTRY", "MACRO", "MICRO", "OTHER".
description A short description of the time series
x A time series of length n (the historical data)
xx A time series of length h (the future data)

89
90 plot.Mdata

Author(s)
Muhammad Akram and Rob Hyndman

Source
http://www.forecasters.org/data/tsdata.htm.
Detailed results from M3 competition at http://www-marketing.wharton.upenn.edu/
forecast/m3-competition.html.

References
Makridakis, S., A. Andersen, R. Carbone, R. Fildes, M. Hibon, R. Lewandowski, J. Newton, E.
Parzen, and R. Winkler (1982) The accuracy of extrapolation (time series) methods: results of a
forecasting competition. Journal of Forecasting, 1, 111153.
Makridakis and Hibon (2000) The M3-competition: results, conclusions and implications. Interna-
tional Journal of Forecasting, 16, 451-476.

See Also
subset.Mcomp, plot.Mdata

Examples
M1
plot(M1$YAF2)
subset(M1,"monthly")

plot.Mdata Plotting M Competition data

Description
plot.Mdata plots a time series from the M competition data sets.

Usage
plot.Mdata(x, xlim=c(start(x$x)[1],end(x$xx)[1]), ylim=range(x$x,x$xx),
main=x$sn, xlab="", ylab="", ...)

Arguments
x A series of M-competition data
xlim Limits on x-axis
ylim Limits on y-axis
main Main title
subset.Mcomp 91

xlab Label on x-axis


ylab Label on y-axis
... Other plotting arguments

Value
None. The function produces a time series plot of the selected series.

Author(s)
Muhammad Akram and Rob Hyndman

See Also
M1

Examples
plot(M1[[1]])
plot(M1$YAF3)
plot(M3$N0647)

subset.Mcomp Subset of time series from the M Competitions

Description
subset.Mcomp returns a subset of the time series data from the M Competitions. Subsets can be
for specific periods, or specific types of data or both.

Usage
## S3 method for class 'Mcomp':
subset(x, cond1, cond2, ...)

Arguments
x M-competition data or a subset of M-competition data
cond1 Type or period of the data. Type is a character variable and period could be
character or numeric.
cond2 Optional second condition specifying type or period of the data, depending on
cond1. If cond1 denotes type then cond2 would denote period, but if cond1
denotes period then cond2 would denote type.
... Other arguments.
92 subset.Mcomp

Details
Possible values for cond1 and cond2 denoting period are 1, 4, 12, "yearly", "quarterly", "monthly"
and "other".
Possible values for cond1 and cond2 denoting type are "macro", "micro", "industry", "finance",
"demographic", "allother", "macro1", "macro2", "micro1", "micro2", "micro3". These correspond
to the descriptions used in the competitions. See the references for details.
Partial matching used for both conditions.

Value
An object of class Mcomp consisting of the selected series.

Author(s)
Muhammad Akram and Rob Hyndman

References
Makridakis, S., A. Andersen, R. Carbone, R. Fildes, M. Hibon, R. Lewandowski, J. Newton, E.
Parzen, and R. Winkler (1982) The accuracy of extrapolation (time series) methods: results of a
forecasting competition. Journal of Forecasting, 1, 111153.
Makridakis and Hibon (2000) The M3-competition: results, conclusions and implications. Interna-
tional Journal of Forecasting, 16, 451-476.

See Also
M1

Examples
M3.quarterly <- subset(M3,4)
M1.yearly.industry <- subset(M1,1,"industry")
Index

Topic datasets huron, 60


advert, 39 ibm, 60
advsales, 40 ibmclose, 61
airpass, 40 input, 62
auto, 41 internet, 62
bank, 42 invent15, 63
beer, 42 jcars, 63
bicoal, 43 kkong, 64
books, 43 labour, 65
boston, 44 lynx, 65
bricksq, 45 M1, 89
canadian, 45 milk, 66
capital, 46 mink, 67
cement, 46 mortal, 67
chicken, 47 motel, 68
condmilk, 48 motion, 68
copper, 48 nail, 69
copper1, 49 oilprice, 70
copper2, 49 olympic, 70
copper3, 50 ozone, 71
cowtemp, 50 paris, 71
cpimel, 51 pcv, 72
dexter, 51 petrol, 73
dj, 52 pigs, 73
dole, 53 plastics, 74
dowjones, 53 pollution, 74
econsumption, 54 productC, 75
eggs, 54 pulpprice, 76
eknives, 55 qelec, 76
elco, 55 qsales, 77
elec, 56 running, 77
expenditure, 56 sales, 78
fancy, 57 schizo, 78
french, 57 shampoo, 79
gas, 19 sheep, 80
gold, 21 ship, 80
housing, 58 shipex, 81
hsales, 59 strikes, 81
hsales2, 59 telephone, 82

93
94 INDEX

texasgas, 82 advert, 39
ukdeaths, 83 advsales, 40
usdeaths, 84 airpass, 40
uselec, 84 ar, 11
ustreas, 85 arima, 2, 24, 6, 911, 13, 27, 28, 31, 34, 36
wagesuk, 85 arima.errors, 4
wheat, 86 arima.predict, 28
wineind, 37 auto, 41
wn, 86 auto.arima (best.arima), 5
wnoise, 87
woolyrnq, 38 bank, 42
writing, 87 beer, 42
Topic data best.arima, 5
subset.Mcomp, 91 bicoal, 43
Topic hplot books, 43
plot.ets, 25 boston, 44
plot.Mdata, 90 BoxCox, 1
Topic ts bricksq, 45
arima, 2
arima.errors, 4 canadian, 45
best.arima, 5 capital, 46
BoxCox, 1 cement, 46
croston, 6 chicken, 47
ets, 8 condmilk, 48
fitted.Arima, 10 copper, 48
forecast, 13 copper1, 49
forecast.Arima, 10 copper2, 49
forecast.ets, 17 copper3, 50
forecast.HoltWinters, 12 cowtemp, 50
forecast.StructTS, 14 cpimel, 51
forecasterrors, 16 croston, 6, 14
gof, 20
meanf, 21 decompose, 27, 32
monthdays, 23 dexter, 51
na.interp, 23 dj, 52
ndiffs, 24 dole, 53
plot.forecast, 18 dowjones, 53
rwf, 26
seasadj, 27 econsumption, 54
seasonaldummy, 28 eggs, 54
seasonplot, 29 eknives, 55
ses, 30 elco, 55
simulate.ets, 31 elec, 56
sindexf, 32 ets, 8, 12, 14, 17, 18, 25, 31, 32
splinef, 33 expenditure, 56
thetaf, 35
tsdisplay, 36 fancy, 57
fitted.Arima, 10
acf, 36, 37 forecast, 13, 18
INDEX 95

forecast.ar (forecast.Arima), 10 na.interp, 23


forecast.Arima, 2, 10, 10, 13, 14 nail, 69
forecast.ets, 13, 14, 17 ndiffs, 24
forecast.HoltWinters, 12, 14
forecast.StructTS, 14, 14 oilprice, 70
forecast.ts, 13 olympic, 70
forecasterrors, 16, 20 ozone, 71
french, 57
par, 25
gas, 19 paris, 71
gof, 16, 20 pcv, 72
gold, 21 petrol, 73
pigs, 73
holt, 14, 34 plastics, 74
holt (ses), 30 plot, 19, 29
HoltWinters, 9, 12, 13, 31 plot.ets, 25
housing, 58 plot.forecast, 18
hsales, 59 plot.Mdata, 90, 90
hsales2, 59 plot.splineforecast
huron, 60 (plot.forecast), 18
hw, 14 plot.ts, 19, 37
hw (ses), 30 pollution, 74
predict.ar, 11
ibm, 60
predict.arima, 11
ibmclose, 61
predict.HoltWinters, 12, 13
input, 62
predict.StructTS, 15
internet, 62
print.ets (ets), 8
InvBoxCox, 18
print.forecast (forecast), 13
InvBoxCox (BoxCox), 1
productC, 75
invent15, 63
pulpprice, 76
jcars, 63
qelec, 76
kkong, 64 qsales, 77
kpss.test, 5, 24
residuals, 4
labour, 65 running, 77
lm, 28 rwf, 9, 11, 14, 22, 26, 31, 36
lynx, 65
sales, 78
M1, 89, 91, 92 schizo, 78
M3 (M1), 89 seasadj, 27
meanf, 14, 21, 27, 36 seasonaldummy, 28
milk, 66 seasonaldummyf (seasonaldummy), 28
mink, 67 seasonplot, 29
monthdays, 23 ses, 7, 14, 30, 36
monthplot, 30 set.seed, 32
mortal, 67 shampoo, 79
motel, 68 sheep, 80
motion, 68 ship, 80
96 INDEX

shipex, 81
simulate.ets, 31
sindexf, 32
smooth.spline, 34
splinef, 14, 33
stl, 27, 32
strikes, 81
StructTS, 15
subset.Mcomp, 90, 91
summary.forecast (forecast), 13

telephone, 82
texasgas, 82
thetaf, 14, 35
tsdisplay, 36

ukdeaths, 83
usdeaths, 84
uselec, 84
ustreas, 85

wagesuk, 85
wheat, 86
wineind, 37
wn, 86
wnoise, 87
woolyrnq, 38
writing, 87

Potrebbero piacerti anche