numInfo | R Documentation |
Computes by numerical derivation the observed information matrix for (ideally) all parameters for mean response model, that is, the matrix of second derivatives of negative log likelihood.
The default value of the which
argument shows all classes of parameters that should be handled, including random-effect parameters (lambda
, ranCoefs
, corrPars
, and hyper
), residual dispersion parameters (phi
, NB_shape
for negbin1
and negbin2
, and beta_prec
for beta_resp
and betabin
), and fixed-effect coefficients (beta
).
Model fits including a phi-resid.model
are not fully handled, in two ways: the information matrix does not include their parameters; and if the residual dispersion model include random effects, there is good reason for the numInfo
calculation to detect that the fit has not maximized marginal likelihood with respect to most parameters.
numInfo(fitobject, transf = FALSE, which = NULL, check_deriv = TRUE,
sing=1e-05, verbose=FALSE, refit_hacks=list(), ...)
fitobject |
Fit object returned by a spaMM fitting function. |
transf |
Whether to perform internal computations on a transformed scale (but computation on transformed scale may be implemented for fewer classes of models than default computation). |
which |
NULL, or character vector giving the sets of parameters with respect to which derivatives are to be computed.
The NULL default is equivalent to |
check_deriv |
Boolean; whether to perform some checks for possible problems (see Details). |
sing |
numeric value, or |
verbose |
Boolean: whether to print (as a list) the estimates of the parameters for which the Hessian will be computed, additional information about possibly ignored parameters, possible misuse of REML fits, and a (sort of) progress bar if the procedure is expected to last more than a few seconds. |
refit_hacks |
list of arguments; its name anticipates that it might allow hazardous manipulations in a later version of spaMM. But currently only the innocuous element |
... |
Arguments passed to |
The computation of a second derivatives is not necessarily meaningful if a first derivative does not vanish at the parameter estimates. This may occur in particular when the objective function (say, marginal likelihood) is maximized at a boundary of the parameter space (say, at zero for lambda
estimates). Further, for such values at a boundary, only one-sided derivatives can be computed, and this is not handled by numDeriv::hessian
. So, some checks may be requested to detect non-zero gradients and parameters estimated at their boundaries. The boundary checks are currently performed for lambda
and ranCoefs
estimates, if check_deriv
is set to TRUE or to NULL. Other parameters are not (yet) checked, so numInfo
may sometimes fails when such other parameter estimates are at a boundary. If check_deriv
is set to TRUE, an additional systematic check of the gradient with respect to all target parameters is performed.
NULL or a matrix.
NULL is returned if no parameter is found with respect to which a numerical information “should” be computed (where what should be done depends on the which
and check_derivs
arguments).
Otherwise a matrix is returned, with an eigvals
attribute if sing
was non-zero. This attribute is a numeric vector of eigenvalues of the matrix. If some eigenvalue(s) were lower than sing
, the vector has additional class "singeigs"
so that its printing is controlled by an ad-hoc print.singeigs
method highlighting the small eigenvalues.
data("wafers")
lmmfit <- fitme(y ~X1+X2+X1*X3+X2*X3+I(X2^2)+(1|batch),data=wafers)
numinfo <- numInfo(lmmfit)
(SEs <- sqrt(diag(solve(numinfo))))
#
# => beta SEs here equal to conditional SEs shown by fit summary.
# Other SEs can be compared to the approximate ones
# for log(phi) and log(lambda), given by
#
# update(lmmfit, control=list(refit=TRUE))
#
# => 1118*0.5289 and 10840*0.1024
data("blackcap")
maternfit <- fitme(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap)
numInfo(maternfit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.