View source: R/GSMARconstructor.R
add_data | R Documentation |
add_data
adds or updates data to object of class 'gsmar
' that defines a GMAR, StMAR,
or G-StMAR model. Also calculates empirical mixing weights, conditional moments, and quantile residuals accordingly.
add_data(
data,
gsmar,
calc_qresiduals = TRUE,
calc_cond_moments = TRUE,
calc_std_errors = FALSE,
custom_h = NULL
)
data |
a numeric vector or class |
gsmar |
a class 'gsmar' object, typically generated by |
calc_qresiduals |
should quantile residuals be calculated? Default is |
calc_cond_moments |
should conditional means and variances be calculated? Default is |
calc_std_errors |
should approximate standard errors be calculated? |
custom_h |
A numeric vector with same the length as the parameter vector: i:th element of custom_h is the difference
used in central difference approximation for partial differentials of the log-likelihood function for the i:th parameter.
If |
Returns an object of class 'gsmar' defining the GMAR, StMAR, or G-StMAR model with the data added to the model. If the object already contained data, the data will be updated. Does not modify the 'gsmar' object given as argument!
Kalliovirta L., Meitz M. and Saikkonen P. 2015. Gaussian Mixture Autoregressive model for univariate time series. Journal of Time Series Analysis, 36(2), 247-266.
Meitz M., Preve D., Saikkonen P. 2023. A mixture autoregressive model based on Student's t-distribution. Communications in Statistics - Theory and Methods, 52(2), 499-515.
Virolainen S. 2022. A mixture autoregressive model based on Gaussian and Student's t-distributions. Studies in Nonlinear Dynamics & Econometrics, 26(4) 559-580.
fitGSMAR
, GSMAR
, iterate_more
, get_gradient
,
get_regime_means
, swap_parametrization
, stmar_to_gstmar
# G-StMAR model without data
params42gs <- c(0.04, 1.34, -0.59, 0.54, -0.36, 0.01, 0.06, 1.28, -0.36,
0.2, -0.15, 0.04, 0.19, 9.75)
gstmar42 <- GSMAR(p=4, M=c(1, 1), params=params42gs, model="G-StMAR")
gstmar42
# Add data to the model
gstmar42 <- add_data(data=M10Y1Y, gsmar=gstmar42)
gstmar42
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.