TFPmodel
Estimates a two-dimensional state-space model and performs filtering and smoothing to obtain the TFP trend using either maximum likelihood estimation or bayesian methods.
# S3 method for TFPmodel
fit(
model,
parRestr = initializeRestr(model = model),
signalToNoise = NULL,
method = "MLE",
control = NULL,
prior = initializePrior(model),
R = 10000,
burnin = ceiling(R/10),
thin = 1,
HPDIprob = 0.85,
pointEstimate = "mean",
MLEfit = NULL,
...
)
For maximum likelihood estimation, an object of class TFPit
containing
the following components:
The input object of class TFPmodel
.
The estimation output from the funtcion fitSSM
from KFAS
.
The filtering and smoothing output from the funtcion KFS
from
KFAS
.
A data frame containing the estimated parameters, including standard errors, t-statistic, and p-values.
A list of matrices containing the enforced parameter constraints.
A list of model fit criteria (see below).
Original call to the function.
The list component fit
contains the following model fit criteria:
Log-likelihood function values.
Akaike information criterion.
Bayesian information criterion.
Hannan-Quinn information criterion.
root mean squared error of the CUBS equation.
R squared of the CUBS equation.
Ljung-Box test output of the CUBS equation.
Signal-to-noise ratio.
For bayesian estimation, an object of class TFPfit
containing the following components:
The input object of class TFPmodel
.
A list of time series containing the estimated states.
A data frame containing the estimated parameters, including standard errors, highest posterior density credible sets.
A list of matrices containing the used prior distributions.
A list of model fit criteria (see below).
Original call to the function.
The list component fit
contains the following model fit criteria:
R squared of the CUBS equation.
Signal-to-noise ratio.
An object of class TFPmodel.
A list of matrices containing the parameter restrictions for the cycle,
trend, and the CUBS equation. Each matrix contains the lower and upper bound of the
involved parameters. NA
implies that no restriction is present. Autoregressive
parameters are automatically restricted to the stationary region unless box constraints
are specified. By default, parRestr
is initialized by the function
initializeRestr(model)
. Only used if method = "MLE"
.
(Optional) signal to noise ratio. Only used if method = "MLE"
.
The estimation method. Options are maximum likelihood estimation "MLE"
and bayesian estimation "bayesian"
. The default is method = "MLE"
.
(Optional) A list of control arguments to be passed on to optim
.
A list of matrices with parameters for the prior distribution and box
constraints. By default, prior
is initialized by initializePrior(model)
.
See details. Only used if method = "bayesian"
.
An integer specifying the number of MCMC draws. The default is R = 10000
.
Only used if method = "bayesian"
.
An integer specifying the burn-in phase of the MCMC chain. The default is
burnin = ceiling(R / 10)
. Only used if method = "bayesian"
.
An integer specifying the thinning interval between consecutive draws. The
default is thin = 1
, implying that no draws are dopped. For thin = 2
,
every second draw is dropped and so on. Only used if method = "bayesian"
.
A numeric in the interval (0,1)
specifying the target probability
of the highest posterior density intervals. The default is HPDIprob = 0.9
. Only
used if method = "bayesian"
.
Posterior distribution's statistic of central tendency. Possible
options are "mean"
and "median"
. The default is pointEstimate = "mean"
.
Only used if method = "bayesian"
.
(Optional) An object of class TFPfit
which is used for
initialization. Only used if method = "bayesian"
.
additional arguments to be passed to the methods functions.
The list object prior
contains three list elements cycle
,
trend
, and cubs
. Each list element is a 4 x n
matrix where n
denotes the number of parameters involved in the respective equation. The upper two
elements specify the distribution, the lower two parameters specify box constraints.
NA
denotes no constraints. Autoregressive parameters are automatically restricted
to the stationary region unless box constraints are specified. For instance,
prior$cycle[, 1]
contains the mean, standard deviation, lower and upper bound for
the first variable, in that respective order.
The respective prior distributions are defined through their mean and standard deviation.
The Gibbs sampling procedure is as follows. For each \(r = 1, ..., R\)
Trend equation parameters \(\theta_{trend}\): Conditional on the states \(\alpha_r\), a draw \(\theta_{trend,k}\) is obtained either by a sequential Gibbs step, a Metropolis Hasting step, or by conjugacy, depending on the trend model specification.
Cycle equation parameters \(\theta_{cycle}\): Conditional on the states \(\alpha_r\), a draw \(\theta_{cycle,k}\) is obtained either by a sequential Gibbs step, a Metropolis Hasting step, or by conjugacy, depending on the cycle model specification.
CUBS equation parameters \(\theta_{cubs}\): Conditional on the states \(\alpha_r\), a draw \(\theta_{cubs,k}\) is obtained either by a sequential Gibbs step, a Metropolis Hasting step, a combination thereof, or by conjugacy, depending on the CUBS equation specification.
Other fitting methods:
fit.KuttnerModel()
,
fit.NAWRUmodel()
,
fit()
# load data for Italy
data("gap")
country <- "Italy"
tsList <- amecoData2input(gap[[country]])
# define tfp model
model <- TFPmodel(tsl = tsList, cycle = "RAR2")
# initialize parameter restrictions and estimate model
parRestr <- initializeRestr(model = model, type = "hp")
# \donttest{
f <- fit(model = model, parRestr = parRestr)
# }
# Bayesian estimation
prior <- initializePrior(model = model)
# \donttest{
f <- fit(model = model, method = "bayesian", prior = prior, R = 5000, thin = 2)
# }
Run the code above in your browser using DataLab