KalmanLike {ts} | R Documentation |
Use Kalman Filtering to find the (Gaussian) log-likelihood, or for forecasting or smoothing.
KalmanLike(y, mod, nit = 0)
KalmanRun(y, mod, nit = 0)
KalmanSmooth(y, mod, nit = 0)
KalmanForecast(n.ahead = 10, mod)
makeARIMA(phi, theta, Delta, kappa = 1e6)
y |
a univariate time series. |
mod |
A list describing the state-space model: see Details. |
nit |
The time at which the initialization is computed.
|
n.ahead |
The number of steps ahead for which prediction is required. |
phi , theta |
numeric vectors of length |
Delta |
vector of differencing coefficients, so an ARMA model is
fitted to |
kappa |
the prior variance (as a multiple of the innovations variance) for the past observations in a differenced model. |
These functions work with a general univariate state-space model
with state vector a
, transitions a <- T a + e
, e ~
N(0, \kappa Q)
and observation equation y = Z'a + R eta},
\eqn{eta ~ N(0, \kappa h)}. The likelihood is a profile likelihood
after estimation of \eqn{\kappa}.
The model is specified as a list with at least components
\describe{
\item{\code{T}}{the transition matrix}
\item{\code{Z}}{the observation coeficients}
\item{\code{h}}{the observation variance}
\item{\code{V}}{\code{RQR'
For KalmanLike
, a list with components Lik
(the
log-likelihood less some constants) and s2
, the estimate of
of \kappa
.
For KalmanRun
, a list with components values
, a vector
of length 2 giving the output of KalmanLike
, resid
(the
residuals) and states
, the contemporaneous state estimates,
a matrix with one row for each time.
For KalmanSmooth
, a list with two components.
Component smooth
is a n
by p
matrix of state
estimates based on all the observations, with one row for each time.
Component smooth
is a n
by p
by p
array of
variance matrices.
For KalmanForecast
, a list with components pred
, the
predictions, and var
, the unscaled variances of the prediction
errors (to be muliplied by s2
).
For makeARIMA
, a model list including components for
its arguments.
These functions are designed to be called from other functions which check the validity of the arguments passed, so very little checking is done.
B. D. Ripley
Durbin, J. and Koopman, S. J. (2001) Time Series Analysis by State Space Methods. Oxford University Press.
arima
, StructTS
. tsSmooth
.