Compute a pseudo r-squared for a fitted model object.
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, ...)
A fitted model object from splm()
, spautor()
, spglm()
, or spgautor()
.
Other arguments. Not used (needed for generic consistency).
A logical indicating whether the pseudo r-squared
should be adjusted to account for the number of explanatory variables. The
default is FALSE
.
The pseudo r-squared as a numeric vector.
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.
spmod <- splm(z ~ water + tarp,
data = caribou,
spcov_type = "exponential", xcoord = x, ycoord = y
)
pseudoR2(spmod)
#> [1] 0.3962946