Compute a pseudo r-squared for a fitted model object.
Usage
pseudoR2(object, ...)
# S3 method for splm
pseudoR2(object, adjust = FALSE, ...)
# S3 method for spautor
pseudoR2(object, adjust = FALSE, ...)
# S3 method for spglm
pseudoR2(object, adjust = FALSE, ...)
# S3 method for spgautor
pseudoR2(object, adjust = FALSE, ...)
Arguments
- object
A fitted model object from
splm()
,spautor()
,spglm()
, orspgautor()
.- ...
Other arguments. Not used (needed for generic consistency).
- adjust
A logical indicating whether the pseudo r-squared should be adjusted to account for the number of explanatory variables. The default is
FALSE
.
Details
Several pseudo r-squared statistics exist for in the literature. We define this pseudo r-squared as one minus the ratio of the deviance of a full model relative to the deviance of a null (intercept only) model. This pseudo r-squared can be viewed as a generalization of the classical r-squared definition seen as one minus the ratio of error sums of squares from the full model relative to the error sums of squares from the null model. If adjusted, the adjustment is analogous to the the classical r-squared adjustment.
Examples
spmod <- splm(z ~ water + tarp,
data = caribou,
spcov_type = "exponential", xcoord = x, ycoord = y
)
pseudoR2(spmod)
#> [1] 0.3962946