fitSSTVAR function

Maximum likelihood estimation of a structural STVAR model based on preliminary estimates from a reduced form model.

Maximum likelihood estimation of a structural STVAR model based on preliminary estimates from a reduced form model.

fitSSTVAR uses a robust method and a variable metric algorithm to estimate a structural STVAR model based on preliminary estimates from a reduced form model.

fitSSTVAR( stvar, identification = c("recursive", "heteroskedasticity", "non-Gaussianity"), B_constraints = NULL, B_pm_reg = NULL, B_perm = NULL, B_signs = NULL, maxit = 1000, maxit_robust = 1000, robust_method = c("Nelder-Mead", "SANN", "none"), print_res = TRUE, calc_std_errors = TRUE )

Arguments

  • stvar: a an object of class 'stvar', created by, e.g., fitSTVAR, specifying a reduced form or a structural model

  • identification: Which identification should the structural model use? (see the vignette or the references for details)

    • "recursive":: The usual lower-triangular recursive identification of the shocks via their impact responses.
    • "heteroskedasticity":: Identification by conditional heteroskedasticity, which imposes constant relative impact responses for each shock.
  • B_constraints: Employ further constraints on the impact matrix? A (d×d)(d \times d) matrix with its entries imposing constraints on the impact matrix BtB_t: NA indicating that the element is unconstrained, a positive value indicating strict positive sign constraint, a negative value indicating strict negative sign constraint, and zero indicating that the element is constrained to zero. Currently only available for models with identification="heteroskedasticity" due to the (in)availability of appropriate parametrizations that allow such constraints to be imposed.

  • B_pm_reg: an integer between 11 and MM specifying the regime the permutations and sign changes of BmB_m

    specified in the arguments B_perm and B_signs are applied to.

  • B_perm: a numeric vector of length dd specifying the permutation of the columns of the impact matrix BmB_m

    of a single regime specified in the argument B_pm_reg prior to re-estimating the model. Applicable only for models with cond_dist = "ind_Student" or "ind_skewed_t".

  • B_signs: a numeric vector specifying the columns of the impact matrix of a single regime specified in the argument B_pm_reg that should be multiplied by -1 prior to reordering them according to B_perm (if specified). Applicable only for models with cond_dist = "ind_Student" or "ind_skewed_t".

  • maxit: the maximum number of iterations in the variable metric algorithm.

  • maxit_robust: the maximum number of iterations on the first phase robust estimation, if employed.

  • robust_method: Should some robust estimation method be used in the estimation before switching to the gradient based variable metric algorithm? See details.

  • print_res: should summaries of estimation results be printed?

  • calc_std_errors: Calculate approximate standard errors (based on standard asymptotics)?

Returns

Returns an S3 object of class 'stvar' defining a smooth transition VAR model. The returned list contains the following components (some of which may be NULL depending on the use case): - data: The input time series data.

  • model: A list describing the model structure.

  • params: The parameters of the model.

  • std_errors: Approximate standard errors of the parameters, if calculated.

  • transition_weights: The transition weights of the model.

  • regime_cmeans: Conditional means of the regimes, if data is provided.

  • total_cmeans: Total conditional means of the model, if data is provided.

  • total_ccovs: Total conditional covariances of the model, if data is provided.

  • uncond_moments: A list of unconditional moments including regime autocovariances, variances, and means.

  • residuals_raw: Raw residuals, if data is provided.

  • residuals_std: Standardized residuals, if data is provided.

  • structural_shocks: Recovered structural shocks, if applicable.

  • loglik: Log-likelihood of the model, if data is provided.

  • IC: The values of the information criteria (AIC, HQIC, BIC) for the model, if data is provided.

  • all_estimates: The parameter estimates from all estimation rounds, if applicable.

  • all_logliks: The log-likelihood of the estimates from all estimation rounds, if applicable.

  • which_converged: Indicators of which estimation rounds converged, if applicable.

  • which_round: Indicators of which round of optimization each estimate belongs to, if applicable.

  • seeds: The seeds used in the estimation in fitSTVAR, if applicable.

  • LS_estimates: The least squares estimates of the parameters in the form (ϕ1,0,...,ϕM,0,φ1,...,φM,α(\phi_{1,0},...,\phi_{M,0},\varphi_1,...,\varphi_M,\alpha (intercepts replaced by unconditional means if mean parametrization is used), if applicable.

Details

When the structural model does not impose overidentifying constraints, it is directly obtained from the reduced form model, and estimation is not required. When overidentifying constraints are imposed, the model is estimated subject to the constraints.

Using the robust estimation method before switching to the variable metric can be useful if the initial estimates are not very close to the ML estimate of the structural model, as the variable metric algorithm (usually) converges to a nearby local maximum or saddle point. However, if the initial estimates are far from the ML estimate, the resulting solution is likely local only due to the complexity of the model. Note that Nelder-Mead algorithm is much faster than SANN but can get stuck at a local solution. This is particularly the case when the imposed overidentifying restrictions are such that the unrestricted estimate is not close to satisfying them. Nevertheless, in most practical cases, the model is just identified and estimation is not required, and often reasonable overidentifying constraints are close to the unrestricted estimate.

Employs the estimation function optim from the package stats that implements the optimization algorithms. See ?optim for the documentation on the optimization methods.

The arguments B_pm_reg, B_perm, and B_signs can be used to explore estimates based various orderings and sign changes of the columns of the impact matrices BmB_m of specific regimes. This can be useful in the presence of weak identification with respect to the ordering or signs of the columns B2,...,BMB_2,...,B_M (see Virolainen 2025).

Examples

## These are long running examples that take approximately 1 minute to run. ## Estimate first a reduced form Gaussian STVAR p=3, M=2 model with the weighted relative # stationary densities of the regimes as the transition weight function, and the means and # AR matrices constrained to be identical across the regimes: fit32cm <- fitSTVAR(gdpdef, p=3, M=2, AR_constraints=rbind(diag(3*2^2), diag(3*2^2)), weight_function="relative_dens", mean_constraints=list(1:2), parametrization="mean", nrounds=1, seeds=1, ncores=1) # Then, we estimate/create various structural models based on the reduced form model. # Create a structural model with the shocks identified recursively: fit32cms_rec <- fitSSTVAR(fit32cm, identification="recursive") # Create a structural model with the shocks identified by conditional heteroskedasticity: fit32cms_hetsked <- fitSSTVAR(fit32cm, identification="heteroskedasticity") fit32cms_hetsked # Print the estimates # Estimate a structural model with the shocks identified by conditional heteroskedasticity # and overidentifying constraints imposed on the impact matrix: positive diagonal element # and zero upper right element: fit32cms_hs2 <- fitSSTVAR(fit32cm, identification="heteroskedasticity", B_constraints=matrix(c(1, NA, 0, 1), nrow=2)) # Estimate a structural model with the shocks identified by conditional heteroskedasticity # and overidentifying constraints imposed on the impact matrix: positive diagonal element # and zero off-diagonal elements: fit32cms_hs3 <- fitSSTVAR(fit32cms_hs2, identification="heteroskedasticity", B_constraints=matrix(c(1, 0, 0, 1), nrow=2)) # Estimate first a reduced form two-regime Threshold VAR p=1 model with # with independent skewed t shocks, and the first lag of the second variable # as the switching variable, and AR matrices constrained to be identical # across the regimes: fit12c <- fitSTVAR(gdpdef, p=1, M=2, cond_dist="ind_skewed_t", AR_constraints=rbind(diag(1*2^2), diag(1*2^2)), weight_function="threshold", weightfun_pars=c(2, 1), nrounds=1, seeds=1, ncores=1) # Due to the independent non-Gaussian shocks, the structural shocks are readily # identified. The following returns the same model but marked as structural # with the shocks identified by non-Gaussianity: fit12c <- fitSSTVAR(fit12c) # Estimate a model based on a reversed ordering of the columns of the impact matrix B_2: fit12c2 <- fitSSTVAR(fit12c, B_pm_reg=2, B_perm=c(2, 1)) # Estimate a model based on reversed signs of the second column of B_2 and reversed # ordering of the columns of B_2: fit12c3 <- fitSSTVAR(fit12c, B_pm_reg=2, B_perm=c(2, 1), B_signs=2)

References

  • Kilian L., Lütkepohl H. 20017. Structural Vector Autoregressive Analysis. 1st edition. Cambridge University Press, Cambridge.
  • Lütkepohl H., Netšunajev A. 2017. Structural vector autoregressions with smooth transition in variances. Journal of Economic Dynamics & Control, 84 , 43-57.
  • Virolainen S. 2025. Identification by non-Gaussianity in structural threshold and smooth transition vector autoregressive models. Unpublished working paper, available as arXiv:2404.19707.

See Also

fitSTVAR, STVAR, optim

  • Maintainer: Savi Virolainen
  • License: GPL-3
  • Last published: 2025-02-27