fit: Estimation of the ARIMA model

fit.ssmR Documentation

Estimation of the ARIMA model

Description

fit fits the univariate model to the time series z.

Usage

## 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,
  ...
)

Arguments

mdl

an object of class um or tfm.

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 updateSSM function.

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 function.

optim.method

the method argument of the optim function.

envir

environment in which the function arguments are evaluated. If NULL the calling environment of this function will be used.

Value

An object of class "ssm" with the estimated parameters.

An object of class "um" with the estimated parameters.

Note

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.

Examples

# 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)

tfarima documentation built on Nov. 5, 2025, 7:43 p.m.