# \donttest{
## These are long-running examples that take approximately 10 seconds to run.
# Estimate a Gaussian STVAR p=1, M=2 model with threshold weight function and
# the first lag of the second variable as the switching variables. Run only two
# estimation rounds and use the two-phase estimation method:
fit12 <- fitSTVAR(gdpdef, p=1, M=2, weight_function="threshold", weightfun_pars=c(2, 1),
nrounds=2, seeds=c(1, 4), estim_method="two-phase")
fit12$loglik # Log-likelihood of the estimated model
# Print the log-likelihood obtained from each estimation round:
fit12$all_logliks
# Construct the model based on the second largest log-likelihood found in the
# estimation procedure:
fit12_alt <- alt_stvar(fit12, which_largest=2, calc_std_errors=FALSE)
fit12_alt$loglik # Log-likelihood of the alternative solution
# Construct a model based on a specific estimation round, the first round:
fit12_alt2 <- alt_stvar(fit12, which_round=1, calc_std_errors=FALSE)
fit12_alt2$loglik # Log-likelihood of the alternative solution
# }
Run the code above in your browser using DataLab