ARXmdl | R Documentation |
This function estimates an ARX model with p
lags.
This can be used for the null hypothesis of a linear model against an
alternative hypothesis of a Markov switching autoregressive model with k
regimes.
ARXmdl(Y, p, Z, control = list())
Y |
A |
p |
Integer determining the number of autoregressive lags. |
Z |
A |
control |
List with model options including:
|
List of class ARmdl
(S3
object) with model attributes including:
y: a (T-p x 1)
matrix of observations.
X: a (T-p x p + const)
matrix of lagged observations with a leading column of 1
s if const=TRUE
or not if const=FALSE
.
x: a (T-p x p)
matrix of lagged observations.
fitted: a (T-p x 1)
matrix of fitted values.
resid: a (T-p x 1)
matrix of residuals.
mu: estimated mean of the process.
beta: a ((1 + p + qz) x 1)
matrix of estimated coefficients.
betaZ: a (qz x q)
matrix of estimated exogenous regressor coefficients.
intercept: estimate of intercept.
phi: estimates of autoregressive coefficients.
stdev: estimated standard deviation of the process.
sigma: estimated variance of the process.
theta: vector containing: mu
, sigma
, and phi
.
theta_mu_ind: vector indicating location of mean with 1
and 0
otherwise.
theta_sig_ind: vector indicating location of variance with 1
and 0
otherwise.
theta_var_ind: vector indicating location of variance with 1
and 0
otherwise. This is the same as theta_sig_ind
in ARmdl
.
theta_phi_ind: vector indicating location of autoregressive coefficients with 1
and 0
otherwise.
stationary: Boolean indicating if process is stationary if TRUE
or non-stationary if FALSE
.
n: number of observations after lag transformation (i.e., n = T-p
).
p: number of autoregressive lags.
q: number of series. This is always 1
in ARmdl
.
k: number of regimes. This is always 1
in ARmdl
.
control: List with model options used.
logLike: log-likelihood.
AIC: Akaike information criterion.
BIC: Bayesian (Schwarz) information criterion.
Hess: Hessian matrix. Approximated using hessian
and only returned if getSE=TRUE
.
info_mat: Information matrix. Computed as the inverse of -Hess
. If matrix is not PD then nearest PD matrix is obtained using nearest_spd
. Only returned if getSE=TRUE
.
nearPD_used: Boolean determining whether nearPD
function was used on info_mat
if TRUE
or not if FALSE
. Only returned if getSE=TRUE
.
theta_se: standard errors of parameters in theta
. Only returned if getSE=TRUE
.
MSARmdl
set.seed(1234)
# Define DGP of AR process
mdl_ar <- list(n = 500,
mu = 5,
sigma = 2,
phi = c(0.5,0.2))
# Simulate process using simuAR() function
y_simu <- simuAR(mdl_ar)
# Set options for model estimation
control <- list(const = TRUE,
getSE = TRUE)
# Estimate model
y_ar_mdl <- ARmdl(y_simu$y, p = 2, control)
y_ar_mdl
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.