Last chance! 50% off unlimited learning
Sale ends in
Creates a state space model in list form yt = H*B + B^O X^O_t + e_t B = F*B_{t-1} + B^S X^S_t + u_t
stsm_ssm(
par = NULL,
yt = NULL,
decomp = NULL,
trend = NULL,
init = NULL,
model = NULL,
prior = NULL,
freq = NULL,
seasons = NULL,
cycle = NULL,
interpolate = NULL,
interpolate_method = NULL
)
List of space space matrices
Vector of named parameter values, includes the harmonics
Univariate time series of data values
Decomposition model ("tend-cycle-seasonal", "trend-seasonal", "trend-cycle", "trend-noise")
Trend specification ("random-walk", "random-walk-drift", "double-random-walk", "random-walk2"). The default is NULL which will choose the best of all specifications based on the maximum likelihood. "random-walk" is the random walk trend. "random-walk-drift" is the random walk with constant drift trend. "double-random-walk" is the random walk with random walk drift trend. "random-walk2" is a 2nd order random walk trend as in the Hodrick-Prescott filter.
Initial state values for the Kalman filter
a stsm_estimate model object
Model prior built from stsm_prior. Only needed if prior needs to be built for initial values
Frequency of the data. Only needed if prior needs to be built for initial values and prior = NULL
Numeric vector of seasonal frequencies. Only needed if prior needs to be built for initial values and prior = NULL
Numeric value for the cycle frequency. Only needed if prior needs to be built for initial values and prior = NULL
Character string of how to interpolate
Character string for the method of interpolation
if (FALSE) {
#GDP Not seasonally adjusted
library(autostsm)
data("NA000334Q", package = "autostsm") #From FRED
NA000334Q = data.table(NA000334Q, keep.rownames = TRUE)
colnames(NA000334Q) = c("date", "y")
NA000334Q[, "date" := as.Date(date)]
NA000334Q[, "y" := as.numeric(y)]
NA000334Q = NA000334Q[date >= "1990-01-01", ]
stsm = stsm_estimate(NA000334Q)
ssm = stsm_ssm(model = stsm)
}
Run the code above in your browser using DataLab