fit.NAWRUmodel {RGAP} | R Documentation |
Estimation of a NAWRUmodel
Description
Estimates a two-dimensional state-space model and performs filtering and smoothing to obtain the NAWRU using either maximum likelihood estimation or bayesian methods.
Usage
## S3 method for class 'NAWRUmodel'
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 NAWRUmodel. |
parRestr |
A list of matrices containing the parameter restrictions for the cycle,
trend, and the Phillip's curve. 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 pcInd
. 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
The states are sampled by running the Kalman filter and smoother conditional on the parameters of the previous step,
\theta_{r-1}
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.Phillip's curve equation parameters
\theta_{pcInd}
: Conditional on the states\alpha_r
, a draw\theta_{pcInd,k}
is obtained either by a sequential Gibbs step, a Metropolis Hasting step, a combination thereof, or by conjugacy, depending on the Phillip's curve equation specification.
Value
For maximum likelihood estimation, an object of class NAWRUfit
containing
the following components:
model |
The input object of class |
SSMfit |
The estimation output from the function |
SSMout |
The filtering and smoothing output from the function |
parameters |
A data frame containing the estimated parameters, including standard errors, t-statistics, 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 Phillip's curve equation. |
R2 |
R squared of the Phillip's curve equation. |
LjungBox |
Ljung-Box test output of the Phillip's curve equation. |
signal-to-noise |
Signal-to-noise ratio. |
For bayesian estimation, an object of class NAWRUfit
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 phillips curve equation, |
signal-to-noise |
Signal-to-noise ratio. |
See Also
Other fitting methods:
fit.KuttnerModel()
,
fit.TFPmodel()
,
fit()
Examples
# define nawru model for France
data("gap")
country <- "France"
tsList <- amecoData2input(gap[[country]])
model <- NAWRUmodel(tsl = tsList)
# estimate nawru model via MLE
parRestr <- initializeRestr(model = model, type = "hp")
f <- fit(model = model, parRestr = parRestr)
# initialize priors and estimate model via Bayesian methods
prior <- initializePrior(model = model)
f <- fit(model = model, method = "bayesian", prior = prior, R = 5000, thin = 2)