Learn R Programming

⚠️There's a newer version (3.5.2) of this package.Take me there.

uGMAR

The goal of uGMAR is to provide tools for analysing Gaussian mixture autoregressive (GMAR), Student’s t mixture Autoregressive (StMAR) and Gaussian and Student’s t mixture autoregressive (G-StMAR) models. uGMAR provides functions for unconstrained and constrained maximum likelihood estimation of the model parameters, quantile residual based model diagnostics, simulation from the processes, and forecasting.

Installation

You can install the released version of uGMAR from CRAN with:

install.packages("uGMAR")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("saviviro/uGMAR")

Example

This is a basic example how to estimate a GMAR model to data. For details about the example data “logVIX” see ?logVIX. The estimation process is computationally demanding and takes advantage of parallel computing. After estimating the model, it’s shown by simple examples how to conduct some further analysis.

## Estimate a GMAR(1, 2) model to logarithmized VIX data
data(logVIX, package="uGMAR")
fit <- fitGSMAR(data=logVIX, p=1, M=2, model="GMAR")
fit
summary(fit) # Approximate standard errors in brackets
plot(fit)

get_gradient(fit) # The first order condition
get_soc(fit) # The second order condition (eigenvalues of approximated Hessian)

## Quantile residual diagnostics
quantileResidualPlot(fit)
diagnosticPlot(fit)
qrt <- quantileResidualTests(fit)

## Simulate a sample path from the estimated process
sim <- simulateGSMAR(fit, nsimu=10)

## Forecast future values of the process
predict(fit, n_ahead=10)

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 ** eco**n.E**M **
  • 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.

Copy Link

Version

Install

install.packages('uGMAR')

Monthly Downloads

392

Version

3.2.0

License

GPL-3

Maintainer

Savi Virolainen

Last Published

August 27th, 2019

Functions in uGMAR (3.2.0)

add_data

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

Calculate gradient or Hessian matrix
all_pos_ints

Check whether all arguments are positive scalar whole numbers
IE

University of Michigan: inflation expectation time series: IE
add_dfs

Add random dfs to a vector
GAfit

Genetic algorithm for preliminary estimation of GMAR, StMAR or G-StMAR model
changeRegime

Change the specified regime of parameter vector to the given regime-parameter vector
alt_gsmar

Construct a GSMAR model based on results from an arbitrary estimation round of fitGSMAR
VIX

CBOE Volatility Index: VIX
GSMAR

Create object of class 'gsmar' defining a GMAR, StMAR or G-StMAR model
check_data

Check that given object contains data
diagnosticPlot

Quantile residual based diagnostic plots for GMAR, StMAR and G-StMAR models
condMoments

Calculate conditional moments of GMAR, StMAR or G-StMAR model
get_regime_vars

Calculate regime specific variances \(\gamma_{m,0}\)
checkConstraintMat

Check the constraint matrices
get_varying_h

Get differences 'h' which are adjusted for overly large degrees of freedom parameters
checkPM

Check p and M are correctly set
change_parametrization

Change parametrization of the parameter vector
checkAndCorrectData

Check the data is set correctly and correct if not
check_model

Check that the argument model is correctly specified.
check_params_length

Check that the parameter vector has the correct dimension
get_regime_autocovs

Calculate regime specific autocovariances \(\gamma\)\(_{m,p}\)
get_IC

Calculate AIC, HQIC and BIC
nParams

Calculate the number of parameters
loglikelihood

Compute the log-likelihood of GMAR, StMAR or G-StMAR model
quantileResidualPlot

Ploy quantile residual time series and kernel density
parameterChecks

Check the parameter vector is specified correctly
check_gsmar

Check that given object has class attribute 'gsmar'
get_regime_means

Calculate regime specific means \(\mu_{m}\)
format_valuef

Function factory for value formatting
fitGSMAR

Estimate Gaussian or Student's t Mixture Autoregressive model
extractRegime

Extract regime from a parameter vector
plot.qrtest

Quantile residual tests for GMAR, StMAR or G-StMAR model
getOmega

Generate covariance matrix Omega for quantile residual tests
isStationary_int

Check the stationary and identification conditions of specified GMAR, StMAR or G-StMAR model.
isStationary

Check the stationary condition of specified GMAR, StMAR or G-StMAR model.
pick_pars

Pick \(\phi_0\) (or \(\mu\)), AR-coefficients and variance parameters from parameter vector
pick_phi0

Pick phi0 or mean parameters from parameter vector
reformConstrainedPars

Reform parameter vector with linear constraints to correspond non-constrained parameter vector.
iterate_more

Maximum likelihood estimation of GMAR, StMAR or G-StMAR model with preliminary estimates
logVIX

CBOE Volatility Index: logVIX
print.gsmarpred

print method for class 'gsmarpred' objects
print.gsmarsum

Print method from objects of class 'gsmarsum'
pick_alphas

Pick mixing weights parameters from parameter vector
get_ar_roots

Calculate absolute values of the roots of the AR characteristic polynomials
pick_dfs

Pick degrees of freedom parameters from parameter vector
randomIndividual_int

Create random GMAR, StMAR or G-StMAR model compatible parameter vector
randomIndividual

Create random GMAR, StMAR or G-StMAR model compatible parameter vector
reformRestrictedPars

Reform parameter vector with restricted autoregressive parameters to correspond non-restricted parameter vector.
mixingWeights

Calculate mixing weights of GMAR, StMAR or G-StMAR model
regime_distance

Calculate "distance" between two regimes
mixingWeights_int

Calculate mixing weights of GMAR, StMAR or G-StMAR model
random_arcoefs

Create random AR coefficients
plot.gsmarpred

plot method for class 'gsmarpred' objects
loglikelihood_int

Compute the log-likelihood of GMAR, StMAR or G-StMAR model
predict.gsmar

Forecast GMAR, StMAR or G-StMAR process
swap_parametrization

Swap the parametrization of object of class 'gsmar' defining a gsmar model
uncondMoments

Calculate unconditional mean, variance, first p autocovariances and autocorrelations of the GSMAR process.
reformParameters

Reform any parameter vector into standard form.
uncondMoments_int

Calculate unconditional mean, variance, first p autocovariances and autocorrelations of the GSMAR process.
random_regime

Create random regime
uGMAR

uGMAR: Estimate Univariate Gaussian or Student's t Mixture Autoregressive Model
warn_dfs

Warn about large degrees of freedom parameter values
stmar_to_gstmar

Estimate a G-StMAR model based on StMAR model with large degrees of freedom parameters
stmarpars_to_gstmar

Transform a StMAR model parameter vector to a corresponding G-StMAR model parameter vector with large dfs parameters reduced.
quantileResiduals

Compute quantile residuals of GMAR, StMAR or G-StMAR model
quantileResiduals_int

Compute quantile residuals of GMAR, StMAR or G-StMAR model
standardErrors

Calculate standard errors for estimates of GMAR, StMAR or GStMAR model
sortComponents

Sort the mixture components of GMAR, StMAR or G-StMAR model
removeAllConstraints

Transform constrained and restricted parameter vector into the regular form
simulateGSMAR

Simulate values from GMAR, StMAR or G-StMAR process