Description Usage Arguments Details Value References See Also Examples
The method vcov
computes the variance-covariance matrix of the parameters fitted
in a structural time series model. This matrix is used to compute confidence
intervals for those parameters returned by the coef.stsmFit
method.
1 2 3 4 5 6 7 8 9 10 11 12 | ## S3 method for class 'stsmFit'
vcov(object,
type = c("hessian", "infomat", "OPG", "sandwich", "optimHessian"), ...)
## S3 method for class 'stsm'
vcov(object,
type = c("hessian", "infomat", "OPG", "sandwich"),
domain = c("frequency", "time"), ...)
## S3 method for class 'stsmFit'
confint(object, parm, level = 0.95,
type = c("vcov", "bootstrap"),
vcov.type = c("hessian", "infomat", "OPG", "sandwich", "optimHessian"),
breps = 100, ...)
|
object |
a |
type |
a character. In |
domain |
a character indicating whether the covariance matrix is obtained upon the frequency or time domain likelihood function. |
parm |
character indicating the name of the parameter on to obtain the confidence interval. If missing, all parameters are considered. |
level |
the confidence level. |
vcov.type |
a character indicating the type of covariance matrix.
Ignored if |
breps |
number of bootstrap replicates. Ignored if |
... |
additional arguments to be passed to the functions called in these methods. Currently ignored. |
The following estimators of the covariance matrix of parameter estimates are available (Davidson and MacKinnon (2004), Section 10.4):
hessian
: the inverse of the analytical Hessian.
infomat
: the inverse of the analytical expression for the information matrix.
OPG
: the inverse of the outer product of the analytical gradient.
Also known as the BHHH estimator since it was proposed by
Berndt, Hall, Hall and Hausman (1974).
This method requires only first order derivatives. It tends to be less
reliable in small samples.
sandwich
: the sandwich estimator defined as:
H^{-1} (G'G) H^{-1},
where G is the gradient vector and H is the Hessian matrix.
It requires more computations and
may be unreliable in small samples. However, contrary to the previous methods,
it is valid when the information matrix equality does not hold
for example due to misspecification of the model.
optimHessian
: the inverse of the numerical Hessian
returned by optim
.
The natural input for the method method vcov
is a stsmFit
list returned by maxlik.fd
or maxlik.td
.
However, vcov
can be also applied directly on a
stsm
model object.
This is useful for example when maximum likelihood parameter estimates
are found by means of optim
using the functions
maxlik.fd.optim
or maxlik.fd.optim
. In that case,
only the covariance matrix based on the numerical Hessian returned by
optim
would be available. Updating the slot pars
of a
stsm
model object with the parameter values obtained from other
algorithm is a convenient solution to obtain the covariance matrix
based on other methods available in vcov.stsmFit
.
For the time domain likelihood function the covariance matrix of the
initial state vector is considered diagonal, P0cov = FALSE
.
The analytical Hessian for the time domain version is not available, the information matrix is used instead.
By default, vcov.type = "infomat"
for the time domain likelihood function
and vcov.type = "hessian"
for the frequency domain likelihood function.
Confidence intervals can either be computed upon the covariance
matrix of the parameter estimates (type = "vcov"
) or by means of
bootstrapping (type = "bootstrap"
).
The bootstrap approach takes advantage of the following result
(Harvey (1989) eq. (4.3.25)):
4π I(λ_j) / g(λ_j) \sim χ^2_2, \hbox{ for } j\neq 0, n/2 \hbox{ (for n even)}
2π I(λ_j) / g(λ_j) \sim χ^2_1, \hbox{ for } j=0, n/2 \hbox{ (for n even)}
where I(λ_j) and g(λ_j) are respectively the periodogram and
the spectral generating function at frequency λ_j.
Upon this result, bootstrap replicates of the periodogram are generated and
for each of them parameter estimates are obtained maximizing the spectral
likelihood function. The quantiles of the bootstrapped parameter estimates are
the confidence interval.
Dahlhaus and Janas (1996) studied the properties of the frequency domain bootstrap
which has been applied, among others, in Koopman and Wong (2006).
An advantage of the bootstrap method is that it yields confidence intervals
within the bounds of the parameters, i.e., positive variances.
This procedure is computationally intensive and requires some time to run,
especially for large breps
.
vcov.stsm, vcov.stsmFit |
return the covariance matrix of the parameters of the model. |
confint.stsmFit |
returns a matrix containing confidence intervals for the parameters of the model. |
Berndt, E. R., Hall, B. H., Hall, R. E. and Hausman, J. A. (1974). ‘Estimation and inference in nonlinear structural models’. Annals of Economic and Social Measurement, 3, pp. 653-65.
Dahlhaus, R. and Janas, D. (1996). ‘A Frequency Domain Bootstrap for Ratio Statistics in Time Series Analysis’. Annals of Statistics, 24(5), pp. 1934-1963.
Davidson, R. and MacKinnon, J. G. (2004). Section 10.4. Econometric Theory and Methods. Oxford University Press.
Koopman, S. J. and Wong, S. Y. (2006). ‘Extracting Business Cycles using Semi-Parametric Time-varying Spectra with Applications to US Macroeconomic Time Series’. Tinbergen Institute Discussion Papers, No. 2006-105/4. http://papers.tinbergen.nl/06105.pdf
maxlik.fd
,
maxlik.td
,
methods-stsmFit
,
stsm
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
data("llmseas")
# fit the local level plus seasonal model with default arguments
# using the Newton-Raphson algorithm
m <- stsm.model(model = "llm+seas", y = llmseas)
res <- maxlik.fd.scoring(m = m, information = "observed")
coef(res)
# confidence intervals for parameter estimates ...
# ... based on the covariance matrix of parameter estimates
# gives a warning since the lower limit of the confidence interval
# for parameter 'var2' was forced to be non-negative (fixed to 0)
civcov <- confint(res, type = "vcov", vcov.type = "hessian")
civcov
# ... based on bootstrapping the periodogram
# NOTE: this will take a while to run
set.seed(643)
ciboot <- confint(res, type = "bootstrap", breps = 100)
ciboot
## End(Not run)
|
var1 var2 var3
200.33269 11.08894 164.28570
Warning message:
In confintStsmFitVcov(object, parm, level, vcov.type) :
‘confint’ did not account for the fact that some of the parameters lied
outside the boundary of the parameter space.
2.5% 97.5%
var1 76.80890 323.85649
var2 0.00000 22.65248
var3 66.29777 262.27362
2.5% 97.5%
var1 84.584069 300.05447
var2 2.638915 25.68343
var3 81.044106 289.78798
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.