Learn R Programming

spaMM (version 2.0.0)

extractors:

Description

logLik extracts the log-likelihood (exact or approximated). get_any_IC and AIC.HLfit compute model selection/information criteria such as AIC. See AIC for more information about these criteria. dev_resids returns a vector of deviance residuals. deviance returns the sum of these deviance residuals. fitted extracts fitted values (see fitted.values). residuals extracts residuals of the fit. fixef extracts the fixed effects coefficients, \(\beta\). ranef extracts the predicted random effects, Lv (default since version 1.12.0), or u (see Details in HLfit for definitions). vcov returns the variance-covariance matrix of the fixed-effects coefficients. Corr returns a correlation matrix of random effects. getDistMat extracts a distance matrix for a Mat<U+00E9>rn correlation model. get_ZALMatrix extracts the design matrix for the random effects \(v\). get_RLRTSim_args extracts a list of arguments suitable for calls to LRTSim::RLRTSim()

Usage

# S3 method for HLfit
logLik(object,which,...)
# S3 method for HLfit
fitted(object,...)
# S3 method for HLfit
fixef(object,...)
# S3 method for HLfit
ranef(object, type="correlated", ...)
# S3 method for HLfit
vcov(object,...)
# S3 method for HLfit
deviance(object,...)
getDistMat(object,scaled=FALSE)
Corr(object,...)
dev_resids(object,...)
get_any_IC(object, ..., verbose=interactive())
get_RLRTSim_args(object,...)
get_ZALMatrix(object,as_matrix)
# S3 method for HLfit
AIC(object, ..., k, verbose=interactive())

Arguments

object
The return object of an HLfit or similar function.
type
Use type="correlated" (default) to display the correlated random effects (Lv), whether in a spatial model, or a random- coefficient model. Use type="uncorrelated" to pretty-print the elements of the <object>$ranef vector (u).
which
Which element of the APHLs list to return. The default depends on the fitting method.In particular, if it was REML or one of its variants, the function returns the log restricted likelihood (exact or approximated).
scaled
If FALSE, the function ignores the scale parameter \(rho\) and returns unscaled distance.
as_matrix
Boolean: whether to always return a matrix; otherwise as Matrix may be returned.
verbose
Whether to print the model selection criteria or not.
k
For AIC, unused by HLfit method, but included to conform to the generic.
Other arguments that may be needed by some method.

Value

Return values are numeric (for logLik), vectors (most cases), matrices (for vcov), matrices or dist objects (for getDistMat). ranef returns a vector with attributes, which inherits from class ranef which has its own (undocumented) print method.

Corr returns a list, for the different random effect terms, of unconditional correlation matrix of the random effects “v” (see Details of HLfit for definitions).

get_any_IC computes, optionally prints, and returns invisibly the following quantities. The Effective degrees of freedom for the random effects (approximately) characterizes the expectation of a goodness of fit statistic discussed by Lee and Nelder (2001), which gave a general formula for it in HGLMs. The conditional AIC (Vaida and Blanchard 2005) is notable in involving the conditional likelihood and the effective degrees of freedom. Lee et al. (2006) and Ha et al (2007) defined a corrected AIC [i.e., AIC(D*) in their eq. 7] that is here interpreted as the conditional AIC. The conditional AIC returned by HLfit includes both this effective df, the df for estimated fixed effects, and the df for estimated parameters of the variance of random effects. Also returned are the marginal AIC (Akaike's classical AIC), and a focussed AIC for dispersion parameters (dispersion AIC) discussed by Ha et al (2007; eq.10). This diversity of criteria should encourage users to think twice before applying model selection automatically, which is no better although more fashionable than misuses of simple null hypothesis testing. Also, alternative procedures for model choice can be considered (e.g. Cox and Donnelly, 2011, p. 130-131).

get_RLRTSim_args extracts a list of arguments suitable for a call to LRTSim::RLRTSim() for a small-sample test of the presence of a random effect by an efficient simulation procedure. The test can be run by do.call("RLRTSim",<get_RLRTSim_args return value>).

References

Cox, D. R. and Donnelly C. A. (2011) Principles of Applied Statistics. Cambridge Univ. Press.

Ha, I. D., Lee, Y. and MacKenzie, G. (2007) Model selection for multi-component frailty models. Statistics in Medicine 26: 4790-4807.

Lee, Y., Nelder, J. A. (2001) Hierarchical generalised linear models: A synthesis of generalised linear models, random-effect models and structured dispersions. Biometrika 88, 987-1006.

Lee, Y., Nelder, J. A. and Pawitan, Y. (2006) Generalized linear models with random effects: unified analysis via h-likelihood. Chapman & Hall: London.

Vaida, F., and Blanchard, S. (2005) Conditional Akaike information for mixed-effects models. Biometrika 92, 351-370.

Examples

Run this code
data(wafers)
m1 <- HLfit(y ~X1+X2+(1|batch),
          resid.model = ~ 1 ,data=wafers,HLmethod="ML")
get_any_IC(m1)          
fixef(m1)
vcov(m1)
ranef(m1)

Run the code above in your browser using DataLab