View source: R/estimation_tools.R
estim_wrap | R Documentation |
estim_wrap
estimates the model for a given data matrix and
a vector of Kronecker indices. The user must also specify the
maximum number of iterations used for the estimation as well as
the convergence criterion.
estim_wrap(
df,
nu,
degs = NULL,
maxit = 250,
conv_crit = 0.001,
init0 = 1,
verbose = TRUE,
h = 50
)
df |
|
nu |
|
degs |
Optional, vector of length 2, defining the lag orders of |
maxit |
Maximum number of iterations in the estimation procedure, defaults to 250 |
conv_crit |
Convergence criterion in the estimation, defaults to 1e-3 |
init0 |
For the estimation of initial values, specify either
|
verbose |
Should the estimation process be printed? |
h |
The IRF horizon |
a list of elements
Sigma |
The |
ll_val |
The log-likelihood value of the model |
conv_stat |
Convergence criterion and the model log-likelihood value for every iteration of the EM algorithm |
npar |
The number of estimated parameters in |
aic |
Akaike IC for the model |
bic |
Bayesian IC for the model |
hqic |
Hannan-Quinn IC for the model |
rmfd_final |
The final model in |
irf |
The estimated raw impulse response function in an array |
df <- FRED_light$df
# small Kronecker index dimension, should converge fast
nu <- c(1,1)
est_obj <- estim_wrap(df = df, nu = nu)
# graphical analysis of the convergence of the EM algorithm
## Not run:
# create data frame containing the number of iterations, log-likelihood
# value of the model for given iteration and the convergence
# criterion for plotting purposes
d <- data.frame("iter" = 1:length(est_obj$conv_stat$ll_value),
"loglik" = est_obj$conv_stat$ll_value,
"conv.log10" = est_obj$conv_stat$conv_cr %>% log10)
opar <- par()$mar # save default plot setup
par(mar = c(5,5,2,5))
with(d, plot(iter, conv.log10, type="l", col="red3",
ylab=expression(log[10](italic(Delta))),
ylim=c(-3,0)))
par(new = T)
with(d, plot(iter, loglik, pch=1, axes=F, xlab=NA, ylab=NA, cex=1.2))
axis(side = 4)
mtext(side = 4, line = 3, 'model log likelihood value')
legend("topleft",
legend=c(expression(log[10](italic(Delta))), "log-likelihood"),
lty=c(1,0), pch=c(NA, 1), col=c("red3", "black"))
# reset graphical parameters to default
par(new = FALSE, mar = opar)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.