Description Usage Arguments Details Value See Also Examples
Common methods to print and display results for an object of class
stsm
or stsmFit
returned by
functions maxlik.fd
and maxlik.fd
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## S3 method for class 'stsmFit'
coef(object, ...)
## S3 method for class 'stsmFit'
print(x, digits = max(3L, getOption("digits") - 3L),
vcov.type = c("hessian", "infomat", "OPG", "sandwich", "optimHessian"), ...)
## S3 method for class 'stsmFit'
fitted(object, std.rediduals = TRUE, version = c("KFKSDS", "stats"), ...)
## S3 method for class 'stsmFit'
residuals(object, standardised = FALSE, version = c("KFKSDS", "stats"), ...)
## S3 method for class 'stsmComponents'
plot(x, ...)
## S3 method for class 'stsm'
predict(object, n.ahead = 1L, se.fit = TRUE,
version = c("KFKSDS", "stats"), ...)
## S3 method for class 'stsmFit'
predict(object, n.ahead = 1L, se.fit = TRUE,
version = c("KFKSDS", "stats"), ...)
## S3 method for class 'stsmPredict'
plot(x, ...)
## S3 method for class 'stsm'
tsSmooth(object, version = c("KFKSDS", "stats"), ...)
## S3 method for class 'stsmFit'
tsSmooth(object, version = c("KFKSDS", "stats"), ...)
## S3 method for class 'stsmSmooth'
plot(x, ...)
## S3 method for class 'stsmFit'
tsdiag(object, gof.lag = 10L, ...)
|
object |
an object of class |
x |
a |
digits |
minimal number of significant digits, see |
vcov.type |
a character indicating the type of covariance matrix to be used to compute the standard errors of the parameter estimates. |
version |
a character indicating whether the Kalman filter and smoother functions from package KFKSDS or from the stats package should be used. |
std.rediduals |
logical. If |
standardised |
logical. If |
n.ahead |
a numeric, number of observations ahead to perform prediction. |
se.fit |
logical. If |
gof.lag |
numeric, number of lag autocorrelation coefficients to which apply the Box test. |
type |
A character. Type of information used to compute the covariance matrix of the parameters of the fitted model: information matrix, Hessian or a mixture of them. |
... |
additional arguments to be passed to the functions called in these methods. |
These methods are based on those with the same name available for the output
returned by StructTS
in the stats package.
These methods are originally intended to provide summary information from
a model fitted by maximum likelihood.
Thus, the most natural input for them is a stsmFit
list returned by
maxlik.fd
and maxlik.td
.
Nevertheless, as the information and the data required by these methods
are available in the slots of a stsm
object, they
can also be applied directly on an object of class stsm
.
This can be useful, for example, when we know a set of parameter estimates
that was obtained from a method other than maxlik.fd
or maxlik.td
.
By simply updating the slot pars
of the stsm
object,
the residuals and the filtered and smoothed components
are readily available through these methods.
In most cases, the ellipsis, ...
, is kept in the definitions of the methods
just because it is part of the parent method. It has some functionality nonetheless.
For the methods fitted.stsm
and predict.stsm
it can be used to pass
argument P0cov
to function char2numeric
.
It can also be used to pass graphical parameters to par
in
method plot.stsmComponents
and plot.stsmSmooth
or to plot
in plot.stsmPredict
and plot.stsmSmooth
.
By default in method fitted
, std.rediduals = TRUE
so that
it behaves as in previous versions of the package where this
argument was not available.
In method rediduals
, by default standardised = FALSE
because it is more convenient when used in package tsoutliers
(this argument does not need to be explicitly defined and hence the
method residuals is used in the same way both on arima
models and for stsm
).
The following information is returned by these methods:
coef.stsmFit, print.stsmFit |
optimal parameter values. |
fitted.stsm, fitted.stsmFit |
an list of class |
residuals.stsmFit |
residuals in the fitted model. |
plot.stsmComponents |
plot of the filtered components. |
predict.stsm, predict.stsmFit |
predictions of the input time series and standard errors. |
plot.stsmPredict |
plot of the predictions. |
tsSmooth.stsm, tsSmooth.stsmFit |
smoothed components. |
plot.stsmSmooth |
plot of the smoothed components. |
tsdiag.stsm, tsdiag.stsmFit |
plot of diagnostic tests. |
confint.stsmFit
,
maxlik.fd
,
maxlik.td
,
vcov.stsmFit
,
stsm
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # fit the local level plus seasonal model to a
# sample simulated series
data("llmseas")
m <- stsm.model(model = "llm+seas", y = llmseas)
res <- maxlik.fd.scoring(m = m, step = NULL,
information = "expected", control = list(maxit = 100, tol = 0.001))
print(res)
#diagnostic
tsdiag(res)
# display estimated components with 95% confidence bands
comps <- tsSmooth(res)
plot(comps)
title(main = "smoothed trend and seasonal components")
# plot predictions eight periods ahead
pred <- predict(res, n.ahead = 8, se.fit = TRUE)
plot(pred)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.