| Title: | Order Selection in Vector Autoregression by Mean Square Information Criteria |
|---|---|
| Description: | Implements order selection for Vector Autoregressive (VAR) models using the Mean Square Information Criterion (MIC). Unlike standard methods such as AIC and BIC, MIC is likelihood-free. This method consistently estimates VAR order and has robust performance under model misspecification. For more details, see Hellstern and Shojaie (2025) <doi:10.48550/arXiv.2511.19761>. |
| Authors: | Michael Hellstern [aut, cre] |
| Maintainer: | Michael Hellstern <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-06-02 10:49:06 UTC |
| Source: | https://github.com/cran/micvar |
Simulates coefficient matrices used to generate data from a vector autoregressive process.
gen_coef_mat(k, coefmin, coefmax, dens)gen_coef_mat(k, coefmin, coefmax, dens)
k |
Integer. Dimension of process. |
coefmin |
Numeric. Minimum value of coefficient. See Details. |
coefmax |
Numeric. Maximum value of coefficient. See Details. |
dens |
Numeric. Must be between 0 and 1. Specifies the proportion of non-zero entries in the coefficient matrix. The number of non-zero entries is computed as |
Coefficient values are drawn from a Uniform(coefmin, coefmax) or a Uniform(-coefmax, -coefmin) each with 50% probability.
k x k matrix.
# bivariate coefficient matrix coefmat <- gen_coef_mat(k = 2, coefmin = 0.1, coefmax = 0.3, dens = 0.8) print(coefmat)# bivariate coefficient matrix coefmat <- gen_coef_mat(k = 2, coefmin = 0.1, coefmax = 0.3, dens = 0.8) print(coefmat)
Fits an autoregressive model to the data where the order is selected by minimizing the mean square information criteria. Model fitting is performed using ar.
Any of the methods available in the method argument of ar can be used.
micvar( x, pmax, pmaxst = 2 * pmax, method = "ols", na.action = stats::na.fail, series = deparse1(substitute(x)), demean = TRUE, ... )micvar( x, pmax, pmaxst = 2 * pmax, method = "ols", na.action = stats::na.fail, series = deparse1(substitute(x)), demean = TRUE, ... )
x |
|
pmax |
Integer. Maxmium number of lags to consider. Considered lags will to be |
pmaxst |
Integer (default is |
method |
Character string (default is "ols"). Specifies method to fit the model. Options are: |
na.action |
Function for missing values (default is |
series |
Character string. Name of series. See the |
demean |
Boolean (default is TRUE). Whether or not to demean the series. See the |
... |
Additional arguments for specific method. See ar and its various methods such as ar.yw and ar.ols and their corresponding arguments. |
This function uses the ar functions for fitting. For relevant details of those methods see the Details section of ar.
List with elements. Many of these elements are similar to ar.
order |
Order of fitted model selected by MIC |
penalized_losses |
Numeric vector of penalized losses for orders |
ar |
Estimated autoregression coefficients. See the |
var.pred |
Prediction variance. See the |
x.mean |
Estimated mean. See the |
x.intercept |
Intercept. See the |
n.used |
Number of observations in the time series including missing. See the |
n.obs |
Number of non-missing observations. See the |
pmax |
The value of |
partialacf |
Estimate of partial autocorrelation. See the |
resid |
Residuals from fitted model. See the |
method |
Value of |
series |
Name of the series. See the |
call |
Function call. |
asy.var.coef |
Asymptotic-theory variance matrix of coefficient estimates. See the |
# multivariate example - default is OLS VAR3_2_A <- list(gen_coef_mat(3, 0.1, 0.3, 0.8), # lag 1 gen_coef_mat(3, 0.1, 0.4 , 0.5)) # lag 2 x <- sim_var(VAR3_2_A, n = 5000) mic_model <- micvar(x, pmax = 10) # burg and yule-walker examples mic_model_burg <- micvar(x, pmax = 10, method = "burg") mic_model_yw <- micvar(x, pmax = 10, method = "yw") # univariate example ar_coefs <- list(matrix(0.3,nrow=1), matrix(0.1,nrow=1)) x <- sim_var(ar_coefs, n = 5000) mic_model <- micvar(x, pmax = 10)# multivariate example - default is OLS VAR3_2_A <- list(gen_coef_mat(3, 0.1, 0.3, 0.8), # lag 1 gen_coef_mat(3, 0.1, 0.4 , 0.5)) # lag 2 x <- sim_var(VAR3_2_A, n = 5000) mic_model <- micvar(x, pmax = 10) # burg and yule-walker examples mic_model_burg <- micvar(x, pmax = 10, method = "burg") mic_model_yw <- micvar(x, pmax = 10, method = "yw") # univariate example ar_coefs <- list(matrix(0.3,nrow=1), matrix(0.1,nrow=1)) x <- sim_var(ar_coefs, n = 5000) mic_model <- micvar(x, pmax = 10)
Simulates data from a stable vector autoregressive model with Gaussian innovations and specified coefficient matrices. Stability of the process is verified using verify_stability.
sim_var(A, n, mu = NULL, Sigma = NULL, burn_in = 500)sim_var(A, n, mu = NULL, Sigma = NULL, burn_in = 500)
A |
List of coefficient matrices. Each element in A must be a square matrix. Dimension of matrix determines the number of variables. Length of A determines the order of the process. In the case of univariate time series each entry of A should be a |
n |
Integer. Number of data points to simulate. |
mu |
Vector (default 0s). Means of Gaussian innovations. |
Sigma |
Square matrix (default Identity). Variance of Gaussian innovations. |
burn_in |
Integer (default 500). Number of observations used to start up simulated process. In total |
n x k data matrix.
# multivariate VAR3_2_A <- list(gen_coef_mat(3, 0.1, 0.3, 0.8), # lag 1 gen_coef_mat(3, 0.1, 0.4 , 0.5)) # lag 2 x <- sim_var(VAR3_2_A, n = 1000) # univariate AR2 <- list(matrix(0.5), matrix(0.2)) x <- sim_var(AR2, n = 1000) # non-identity covariance of Gaussian innovations Sigma <- matrix(c(1,0.5,0.9,0.5,1.5,0.7,0.9,0.7,1.25), nrow = 3) x <- sim_var(VAR3_2_A, n = 1000, Sigma = Sigma)# multivariate VAR3_2_A <- list(gen_coef_mat(3, 0.1, 0.3, 0.8), # lag 1 gen_coef_mat(3, 0.1, 0.4 , 0.5)) # lag 2 x <- sim_var(VAR3_2_A, n = 1000) # univariate AR2 <- list(matrix(0.5), matrix(0.2)) x <- sim_var(AR2, n = 1000) # non-identity covariance of Gaussian innovations Sigma <- matrix(c(1,0.5,0.9,0.5,1.5,0.7,0.9,0.7,1.25), nrow = 3) x <- sim_var(VAR3_2_A, n = 1000, Sigma = Sigma)
Stability is verified using the method the method on pages 14-17 of (Lütkepohl 2005). Specifically we generate the coefficient matrix for the VAR(1) representation of the process and check that all eigenvalues have modulus less than 1.
verify_stability(A)verify_stability(A)
A |
List of coefficient matrices. |
None. Throws error if not stable process.
Lütkepohl H (2005). New introduction to multiple time series analysis. Springer Science & Business Media.
VAR3_2_A <- list(gen_coef_mat(3, 0.1, 0.3, 0.8), # lag 1 gen_coef_mat(3, 0.1, 0.4 , 0.5)) # lag 2 verify_stability(VAR3_2_A)VAR3_2_A <- list(gen_coef_mat(3, 0.1, 0.3, 0.8), # lag 1 gen_coef_mat(3, 0.1, 0.4 , 0.5)) # lag 2 verify_stability(VAR3_2_A)