vcov | R Documentation |
These functions provide standard errors for parameters of (dep-)mix models.
## S4 method for signature 'mix'
vcov(object, fixed=NULL, equal=NULL,
conrows=NULL, conrows.upper=NULL, conrows.lower=NULL, tolerance=1e-6,
method="finiteDifferences", ...)
## S4 method for signature 'mix'
standardError(object, fixed=NULL, equal=NULL,
conrows=NULL, conrows.upper=NULL, conrows.lower=NULL, tolerance=1e-6,
method="finiteDifferences", ...)
## S4 method for signature 'mix'
confint(object, level=0.95, fixed=NULL, equal=NULL,
conrows=NULL, conrows.upper=NULL, conrows.lower=NULL, tolerance=1e-6,
method="finiteDifferences", ...)
## S4 method for signature 'mix'
hessian(object, tolerance=1e-6,
method="finiteDifferences", ...)
object |
A (dep-)mix object; see depmix for details. |
fixed , equal |
These arguments are used to specify constraints on a model; see usage details here: |
conrows |
These arguments are used to specify constraints on a model; see usage details here: |
conrows.upper |
These arguments are used to specify constraints on a model; see usage details here: |
conrows.lower |
These arguments are used to specify constraints on a model; see usage details here: |
tolerance |
Threshold used for testing whether parameters are estimated on the boundary of the parameter space; if so, they are ignored in these functions. |
method |
The method used for computing the Hessian matrix of the parameters; currently only a finite
differences method (using |
level |
The desired significance level for the confidence intervals. |
... |
Further arguments passed to other methods; currently not in use. |
vcov
computes the variance-covariance matrix of a (dep-)mix object, either fitted or not.
It does so by first constructing a Hessian matrix through the use of hessian
and then
transforming this as described in Visser et al (2000), taking into account the linear constraints
that are part of the model. Currently, hessian
has a single method
using finite
differences to arrive at an approximation of the second order derivative matrix of the parameters.
confint
and standardError
use vcov
to compute confidence intervals (the confidence
level can be set through an argument) and standard errors respectively. The latter are computed first by
using sqrt(diag(vcov))
and the confidence intervals are computed through the normal approximation.
If and when these methods are applied to fit
'ted models, the linear constraint matrix is
obtained from the mix.fitted
or depmix.fitted
slot lincon
(supplemented with
additional constraints if those are provided through the equal
and other arguments to these
functions).
All four functions exclude parameters that are estimated on or near (this can be controlled using
the tolerance
argument) their boundary values. Setting this argument to zero can result in
error as the fdHess
function requires an environment around the parameter estimate that
provides proper log-likelihood values, which parameter on or over their boundary values are not
guaranteed to provided. Fixed parameters are similarly ignored in these four functions.
vcov
returns a named list with elements vcov
, elements
, and lincon
.
standardError
returns a data.frame
with columns par
, elements
,
and se
. confint
returns a data.frame
with columns par
,
elements
, and two columns for the lower and upper bounds of the confidence intervals
(with the column names indicating the level
of the interval.)
vcov |
: The variance-covariance matrix of the parameters. |
elements |
: Vector of length |
inc |
: 'inc'luded parameter. |
fix |
: 'fix'ed parameter. |
bnd |
: parameter estimated on the boundary. |
par |
: The values of the parameters. |
se |
: The values of the standard errors of the parameters. |
lower/upper |
: The lower and upper bounds of the confidence intervals; column names
indicate the as in 0.5+/-level/2, using the |
Note that the quality of the resulting standard errors is similar to those reported in Visser et al (2000) for both bootstrap and the profile likelihood methods. In Visser et al (2000), the finite differences standard errors were somewhat less precise as they relied on a very parsimonious but indeed less precise method for computing the finite differences approximation (computation time was a much scarcer resource at the time then it is now).
Ingmar Visser
Ingmar Visser, Maartje E. J. Raijmakers, and Peter C. M. Molenaar (2000). Confidence intervals for hidden Markov model parameters. British journal of mathematical and statistical psychology, 53, p. 317-327.
data(speed)
# 2-state model on rt and corr from speed data set
# with Pacc as covariate on the transition matrix
# ntimes is used to specify the lengths of 3 separate series
mod1 <- depmix(list(rt~1,corr~1),data=speed,transition=~Pacc,nstates=2,
family=list(gaussian(),multinomial("identity")),ntimes=c(168,134,137))
# fit the model
set.seed(3)
fmod1 <- fit(mod1)
vcov(fmod1)$vcov # $
standardError(fmod1)
confint(fmod1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.