Learn R Programming

spmodel (version 0.8.0)

fitted.spmodel: Extract model fitted values

Description

Extract fitted values from fitted model objects. fitted.values is an alias.

Usage

# S3 method for splm
fitted(object, type = "response", ...)

# S3 method for splm fitted.values(object, type = "response", ...)

# S3 method for spautor fitted(object, type = "response", ...)

# S3 method for spautor fitted.values(object, type = "response", ...)

# S3 method for spglm fitted(object, type = "response", ...)

# S3 method for spglm fitted.values(object, type = "response", ...)

# S3 method for spgautor fitted(object, type = "response", ...)

# S3 method for spgautor fitted.values(object, type = "response", ...)

Value

The fitted values according to type.

Arguments

object

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

type

"response" for fitted values of the response, "spcov" for fitted values of the spatial random errors, or "randcov" for fitted values of the random effects. If from spglm() or spgautor(), "link" for fitted values on the link scale. The default is "response".

...

Other arguments. Not used (needed for generic consistency).

Details

When type is "response", the fitted values for each observation are the standard fitted values \(X \hat{\beta}\). When type is "spcov" the fitted values for each observation are (generally) the best linear unbiased predictors of the spatial dependent and spatial independent random error. When type is "randcov", the fitted values for each level of each random effect are (generally) the best linear unbiased predictors of the corresponding random effect. The fitted values for type "spcov" and "randcov" can generally be used to check assumptions for each component of the fitted model object (e.g., check a Gaussian assumption).

Examples

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

Run the code above in your browser using DataLab