| fit.ssm | R Documentation |
fit fits the univariate model to the time series z.
## S3 method for class 'ssm'
fit(
mdl,
z = NULL,
updateSSM,
param,
show.iter = FALSE,
tol = 1e-04,
method = "BFGS",
...
)
fit(mdl, ...)
## S3 method for class 'um'
fit(
mdl,
z = NULL,
method = c("exact", "cond"),
optim.method = "BFGS",
show.iter = FALSE,
envir = NULL,
...
)
mdl |
an object of class |
z |
a time series. |
updateSSM |
user function to update the parameters of the SS model. The function must take a model object and a parameter vector as inputs and return an updated model object. |
param |
a numeric vector of named parameters passed to the
|
show.iter |
logical value to show or hide the estimates at the different iterations. |
tol |
numeric. Tolerance to check if a root is close to one. |
method |
Exact/conditional maximum likelihood. |
... |
additional arguments for the |
optim.method |
the |
envir |
environment in which the function arguments are evaluated. If NULL the calling environment of this function will be used. |
An object of class "ssm" with the estimated parameters.
An object of class "um" with the estimated parameters.
The um function estimates the corresponding ARIMA model when a time
series is provided. The fit function is useful to fit a model to
several time series, for example, in a Monte Carlo study.
# Predefined local level model
ucm1 <- ucm(Nile, uc = "llm", fit = FALSE)
ucm1 <- fit(ucm1)
ucm1
# User defined local level model
ssm1 <- ssm(Nile, b = 1, C = 1, S = diag(c(1, 0.5)) )
param <- c(irr = var(Nile), lvl = var(diff(Nile)))
updateSSM <- function(mdl, param) {
mdl$S[1,1] <- param[1]
mdl$S[2,2] <- param[2]
mdl
}
fit(ssm1, updateSSM = updateSSM, param = param)
z <- AirPassengers
airl <- um(i = list(1, c(1, 12)), ma = list(1, c(1, 12)), bc = TRUE)
airl <- fit(airl, z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.