Evaluates the specified State Space model at the parameters specified by the user.
StateSpaceEval(
param,
y,
H_format = NULL,
local_level_ind = FALSE,
slope_ind = FALSE,
BSM_vec = NULL,
cycle_ind = FALSE,
addvar_list = NULL,
level_addvar_list = NULL,
arima_list = NULL,
sarima_list = NULL,
self_spec_list = NULL,
exclude_level = NULL,
exclude_slope = NULL,
exclude_BSM_list = lapply(BSM_vec, FUN = function(x) 0),
exclude_cycle_list = list(0),
exclude_arima_list = lapply(arima_list, FUN = function(x) 0),
exclude_sarima_list = lapply(sarima_list, FUN = function(x) 0),
damping_factor_ind = rep(TRUE, length(exclude_cycle_list)),
format_level = NULL,
format_slope = NULL,
format_BSM_list = lapply(BSM_vec, FUN = function(x) NULL),
format_cycle_list = lapply(exclude_cycle_list, FUN = function(x) NULL),
format_addvar = NULL,
format_level_addvar = NULL,
loglik_only = FALSE
)
Parameters used to construct the system matrices.
N x p matrix containing the N observations of the p dependent variables.
Format of the H system matrix, the variance - covariance matrix of the observation equation.
Boolean indicating whether a local level should be added to the state space model.
Boolean indicating whether a local level + slope should be added to the state space model.
Vector containing the BSM seasonalities that have to be added to the state space model.
Boolean indicating whether a cycle has to be added to the state space model.
A list containing the explanatory variables for each of
the dependent variables. The list should contain p (number of dependent
variables) elements. Each element of the list should be a N x k_p matrix,
with k_p being the number of explanatory variables for the pth
dependent variable. If no explanatory variables should be added for one
of the dependent variables, then set the corresponding element to NULL
.
A list containing the explanatory variables for
each of the dependent variables. The list should contain p (number of
dependent variables) elements. Each element of the list should be a
N x k_p matrix, with k_p being the number of explanatory variables
for the pth dependent variable. If no explanatory variables should be
added for one of the dependent variables, then set the corresponding
element to NULL
.
Specifications of the ARIMA components, should be a list
containing vectors of length 3 with the following format: c(AR, I, MA)
.
Should be a list to allow different ARIMA models for different sets of
dependent variables. Note: The AR and MA coefficients are
constrained such that the AR component is stationary, and the MA
component is invertible.
See ansley1986note;textualstatespacer for details about
the transformation used.
Specifications of the SARIMA components, should be a list containing lists that contain 4 named vectors. Vectors should be named: "s", "ar", "i", "ma". Should be a list of lists to allow different SARIMA models for different sets of dependent variables. Note: The AR and MA coefficients are constrained such that the AR components are stationary, and the MA components are invertible. See ansley1986note;textualstatespacer for details about the transformation used. Note: For multivariate models, the order of "s" matters, as matrix multiplication is not commutative!
A list containing the specification of the self
specified component. See the Details section of StateSpaceFit()
for
extensive details about the format that must be followed for this
argument.
Vector containing the dependent variables that should not get a local level.
Vector containing the dependent variables that should not get a slope.
List of vectors, each vector containing the dependent variables that should not get the corresponding BSM component.
The dependent variables that should not get the corresponding cycle component. Should be a list of vectors to allow different dependent variables to be excluded for different cycles.
The dependent variables that should not be involved in the corresponding ARIMA component. Should be a list of vectors to allow different dependent variables to be excluded for different ARIMA components.
The dependent variables that should not be involved in the corresponding SARIMA component. Should be a list of vectors to allow different dependent variables to be excluded for different SARIMA components.
Boolean indicating whether a damping factor should be included. Must be a vector if multiple cycles are included, to indicate which cycles should include a damping factor.
Format of the Q_level system matrix the variance - covariance matrix of the level state equation.
Format of the Q_slope system matrix, the variance - covariance matrix of the slope state equation.
Format of the Q_BSM system matrix, the variance - covariance matrix of the BSM state equation. Should be a list to allow different formats for different seasonality periods.
Format of the Q_cycle system matrix, the variance - covariance matrix of the cycle state equation. Should be a list to allow different formats for different cycles.
Format of the Q_addvar system matrix, the variance - covariance matrix of the explanatory variables state equation.
Format of the Q_level_addvar system matrix, the variance - covariance matrix of the explanatory variables of the level state equation.
Boolean indicating whether only the loglikelihood should be returned.
A list containing:
function_call
: A list containing the input to the function.
system_matrices
: A list containing the system matrices of
the State Space model.
predicted
: A list containing the predicted components of
the State Space model.
filtered
: A list containing the filtered components of
the State Space model.
smoothed
: A list containing the smoothed components of
the State Space model.
diagnostics
: A list containing items useful for diagnostical tests.
For extensive details about the object returned,
see vignette("dictionary", package = "statespacer")
.
durbin2012timestatespacer
ansley1986notestatespacer
# NOT RUN {
# Evaluates a local level model for the Nile data at given parameters
library(datasets)
y <- matrix(Nile)
eval <- StateSpaceEval(param = c(1, 1), y = y / 100, local_level_ind = TRUE)
# }
Run the code above in your browser using DataLab