fit.TFPmodel {RGAP} | R Documentation |
Estimation of a TFPmodel
Description
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.
Usage
## S3 method for class '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,
...
)
Arguments
model |
An object of class TFPmodel. |
parRestr |
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. |
signalToNoise |
(Optional) signal to noise ratio. Only used if |
method |
The estimation method. Options are maximum likelihood estimation |
control |
(Optional) A list of control arguments to be passed on to |
prior |
A list of matrices with parameters for the prior distribution and box
constraints. By default, |
R |
An integer specifying the number of MCMC draws. The default is |
burnin |
An integer specifying the burn-in phase of the MCMC chain. The default is
|
thin |
An integer specifying the thinning interval between consecutive draws. The
default is |
HPDIprob |
A numeric in the interval |
pointEstimate |
Posterior distribution's statistic of central tendency. Possible
options are |
MLEfit |
(Optional) An object of class |
... |
additional arguments to be passed to the methods functions. |
Details
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
The states are sampled by running the Kalman filter and smoother conditional on the parameters of the previous step,
Trend equation parameters
: Conditional on the states
, a draw
is obtained either by a sequential Gibbs step, a Metropolis Hasting step, or by conjugacy, depending on the trend model specification.
Cycle equation parameters
: Conditional on the states
, a draw
is obtained either by a sequential Gibbs step, a Metropolis Hasting step, or by conjugacy, depending on the cycle model specification.
CUBS equation parameters
: Conditional on the states
, a draw
is obtained either by a sequential Gibbs step, a Metropolis Hasting step, a combination thereof, or by conjugacy, depending on the CUBS equation specification.
Value
For maximum likelihood estimation, an object of class TFPit
containing
the following components:
model |
The input object of class |
SSMfit |
The estimation output from the funtcion |
SSMout |
The filtering and smoothing output from the funtcion |
parameters |
A data frame containing the estimated parameters, including standard errors, t-statistic, and p-values. |
parRestr |
A list of matrices containing the enforced parameter constraints. |
fit |
A list of model fit criteria (see below). |
call |
Original call to the function. |
The list component fit
contains the following model fit criteria:
loglik |
Log-likelihood function values. |
AIC |
Akaike information criterion. |
BIC |
Bayesian information criterion. |
AIC |
Hannan-Quinn information criterion. |
RMSE |
root mean squared error of the CUBS equation. |
R2 |
R squared of the CUBS equation. |
LjungBox |
Ljung-Box test output of the CUBS equation. |
signal-to-noise |
Signal-to-noise ratio. |
For bayesian estimation, an object of class TFPfit
containing the following components:
model |
The input object of class |
tsl |
A list of time series containing the estimated states. |
parameters |
A data frame containing the estimated parameters, including standard errors, highest posterior density credible sets. |
prior |
A list of matrices containing the used prior distributions. |
fit |
A list of model fit criteria (see below). |
call |
Original call to the function. |
The list component fit
contains the following model fit criteria:
R2 |
R squared of the CUBS equation. |
signal-to-noise |
Signal-to-noise ratio. |
See Also
Other fitting methods:
fit.KuttnerModel()
,
fit.NAWRUmodel()
,
fit()
Examples
# 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")
f <- fit(model = model, parRestr = parRestr)
# Bayesian estimation
prior <- initializePrior(model = model)
f <- fit(model = model, method = "bayesian", prior = prior, R = 5000, thin = 2)