Learn R Programming

sstvars (version 1.1.0)

filter_estimates: Filter inappropriate the estimates produced by fitSTVAR

Description

filter_estimates filters out inappropriate estimates produced by fitSTVAR: can be used to obtain the (possibly) appropriate estimate with the largest found log-likelihood (among possibly appropriate estimates) as well as (possibly) appropriate estimates based on smaller log-likelihoods.

Usage

filter_estimates(
  stvar,
  which_largest = 1,
  filter_stab = TRUE,
  calc_std_errors = FALSE
)

Value

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.

LS_estimates

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

Arguments

stvar

a class 'stvar' object defining a structural STVAR model that is identified by heteroskedasticity or non-Gaussianity, typically created with fitSSTVAR.

which_largest

an integer at least one specifying the (possibly) appropriate estimate corresponding to which largest log-likelihood should be returned. E.g., if which_largest=2, the function will return among the estimates that it does not deem inappropriate the one that has the second largest log-likelihood.

filter_stab

Should estimates close to breaking the usual stability condition be filtered out?

calc_std_errors

should approximate standard errors be calculated?

Details

The function goes through the estimates produced by fitSTVAR and checks which estimates are deemed inappropriate. That is, estimates that are not likely solutions of interest. Specifically, solutions that incorporate a near-singular error term covariance matrix (any eigenvalue less than \(0.002\)), any modulus of the eigenvalues of the companion form AR matrices larger than $0.9985$ (indicating the necessary condition for stationarity is close to break), or transition weights such that they are close to zero for almost all \(t\) for at least one regime. Then, among the solutions are not deemed inappropriate, it returns a STVAR models based on the estimate that has the which_largest largest log-likelihood.

The function filter_estimates is kind of a version of alt_stvar that only considers estimates that are not deemed inappropriate

See Also

fitSTVAR, alt_stvar

Examples

Run this code
# \donttest{
 # Fit a two-regime STVAR model with logistic transition weights and Student's t errors,
 # and use two-phase estimation method:
 fit12 <- fitSTVAR(gdpdef, p=1, M=2, weight_function="logistic", weightfun_pars=c(2, 1),
  cond_dist="Student", nrounds=2, ncores=2, seeds=1:2, estim_method="two-phase")
 fit12

 # Filter through inappropriate estimates and obtain the second best appropriate solution:
 fit12_2 <- filter_estimates(fit12, which_largest=2)
 fit12_2 # The same model since the two estimation rounds yielded the same estimate
# }

Run the code above in your browser using DataLab