Learn R Programming

spmodel (version 0.8.0)

pseudoR2: Compute a pseudo r-squared

Description

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, ...)

Value

The pseudo r-squared as a numeric vector.

Arguments

object

A fitted model object from splm(), spautor(), spglm(), or spgautor().

...

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

Run this code
spmod <- splm(z ~ water + tarp,
  data = caribou,
  spcov_type = "exponential", xcoord = x, ycoord = y
)
pseudoR2(spmod)

Run the code above in your browser using DataLab