r.squaredLR: Likelihood-ratio based pseudo-R-squared

r.squaredLRR Documentation

Likelihood-ratio based pseudo-R-squared

Description

Calculate a coefficient of determination based on the likelihood-ratio test (\RsqxLR).

Usage

r.squaredLR(object, null = NULL, null.RE = FALSE, ...)

null.fit(object, evaluate = FALSE, RE.keep = FALSE, envir = NULL, ...)

Arguments

object

a fitted model object.

null

a fitted null model. If not provided, null.fit will be used to construct it. null.fit's capabilities are limited to only a few model classes, for others the null model has to be specified manually.

null.RE

logical, should the null model contain random factors? Only used if no null model is given, otherwise omitted, with a warning.

evaluate

if TRUE evaluate the fitted model object else return the call.

RE.keep

if TRUE, the random effects of the original model are included.

envir

the environment in which the null model is to be evaluated, defaults to the environment of the original model's formula.

...

further arguments, of which only x would be used, to maintain compatibility with older versions (x has been replaced with object).

Details

This statistic is is one of the several proposed pseudo-\Rsq's for nonlinear regression models. It is based on an improvement from null (intercept only) model to the fitted model, and calculated as

\mydequation

R_LR^2=1-\exp(-\frac2n(\log\mathcalL(x)-\log\mathcalL(0))) R² = 1 - exp(-2/n * ㏒ℓ(x) - ㏒ℓ(0)) R^2 = 1 - exp(-2/n * logL(x) - logL(0))

where \logLikx and \logLik0 are the log-likelihoods of the fitted and the null model respectively. ML estimates are used if models have been fitted by REstricted ML (by calling logLik with argument REML = FALSE). Note that the null model can include the random factors of the original model, in which case the statistic represents the ‘variance explained’ by fixed effects.

For OLS models the value is consistent with classical \Rsq. In some cases (e.g. in logistic regression), the maximum \RsqxLR is less than one. The modification proposed by Nagelkerke (1991) adjusts the \RsqxLR to achieve 1 at its maximum: \myequation\barR^2 = R_LR^2 / \max(R_LR^2) R̅² = R² / max(R²) Radj^2 = R^2 / max(R^2) where \myequation\max(R_LR^2) = 1 - \exp(\frac2n\log\mathcalL(\textrm0)) max(R²) = 1 - exp(2 / n * ㏒ℓ(0)) max(R^2) = 1 - exp(2 / n * logL(0)) .

null.fit tries to guess the null model call, given the provided fitted model object. This would be usually a glm. The function will give an error for an unrecognised class.

Value

r.squaredLR returns a value of \RsqxLR, and the attribute "adj.r.squared" gives the Nagelkerke's modified statistic. Note that this is not the same as nor equivalent to the classical ‘adjusted R squared’.

null.fit returns the fitted null model object (if evaluate = TRUE) or an unevaluated call to fit a null model.

Note

\Rsq

is a useful goodness-of-fit measure as it has the interpretation of the proportion of the variance ‘explained’, but it performs poorly in model selection, and is not suitable for use in the same way as the information criteria.

References

Cox, D. R. and Snell, E. J. 1989 The analysis of binary data, 2nd ed. London, Chapman and Hall.

Magee, L. 1990 \Rsq measures based on Wald and likelihood ratio joint significance tests. Amer. Stat. 44, 250–253.

Nagelkerke, N. J. D. 1991 A note on a general definition of the coefficient of determination. Biometrika 78, 691–692.

See Also

summary.lm, r.squaredGLMM

r2 from package performance calculates many different types of \Rsq.


MuMIn documentation built on June 22, 2024, 6:44 p.m.