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. 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".

signalToNoise

(Optional) signal to noise ratio. Only used if method = "MLE".

method

The estimation method. Options are maximum likelihood estimation "MLE" and bayesian estimation "bayesian". The default is method = "MLE".

control

(Optional) A list of control arguments to be passed on to optim.

prior

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".

R

An integer specifying the number of MCMC draws. The default is R = 10000. Only used if method = "bayesian".

burnin

An integer specifying the burn-in phase of the MCMC chain. The default is burnin = ceiling(R / 10). Only used if method = "bayesian".

thin

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".

HPDIprob

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".

pointEstimate

Posterior distribution's statistic of central tendency. Possible options are "mean" and "median". The default is pointEstimate = "mean". Only used if method = "bayesian".

MLEfit

(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.

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 r = 1, ..., R

Value

For maximum likelihood estimation, an object of class TFPit containing the following components:

model

The input object of class TFPmodel.

SSMfit

The estimation output from the funtcion fitSSM from KFAS.

SSMout

The filtering and smoothing output from the funtcion KFS from KFAS.

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 TFPmodel.

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)


[Package RGAP version 0.1.1 Index]