Learn R Programming

uGMAR (version 3.1.0)

add_data: Add data to object of class 'gsmar' defining a GMAR, StMAR or G-StMAR model

Description

add_data adds or updates data to object of class 'gsmar' that defines a GMAR, StMAR or G-StMAR model. Also calculates mixing weights, conditional moments and quantile residuals accordingly.

Usage

add_data(data, gsmar, calc_qresiduals = TRUE, calc_cond_moments = TRUE,
  calc_std_errors = FALSE)

Arguments

data

a numeric vector class 'ts' object containing the data. NA values are not supported.

gsmar

object of class 'gsmar' created with the function fitGSMAR or GSMAR.

calc_qresiduals

should quantile residuals be calculated? Default is TRUE iff the model contains data.

calc_cond_moments

should conditional means and variances be calculated? Default is TRUE iff the model contains data.

calc_std_errors

should approximate standard errors be calculated?

Value

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!

References

  • Kalliovirta L., Meitz M. and Saikkonen P. 2015. Gaussian Mixture Autoregressive model for univariate time series. Journal of Time Series Analysis, 36, 247-266.

  • Meitz M., Preve D., Saikkonen P. 2018. A mixture autoregressive model based on Student's t-distribution. arXiv:1805.04010 [econ.EM].

  • There are currently no published references for the G-StMAR model, but it's a straightforward generalization with theoretical properties similar to the GMAR and StMAR models.

See Also

fitGSMAR, GSMAR, iterate_more, get_gradient, get_regime_means, swap_parametrization, stmar_to_gstmar

Examples

Run this code
# NOT RUN {
# GMAR model without data
params12 <- c(0.18, 0.93, 0.01, 0.86, 0.68, 0.02, 0.88)
gmar12 <- GSMAR(p=1, M=2, params=params12, model="GMAR")
gmar12

# Add data to the model
gmar12 <- add_data(data=logVIX, gmar12)
gmar12
# }

Run the code above in your browser using DataLab