Extract fitted values from fitted model objects. fitted.values
is an alias.
## S3 method for class 'splm'fitted(object, type ="response",...)## S3 method for class 'splm'fitted.values(object, type ="response",...)## S3 method for class 'spautor'fitted(object, type ="response",...)## S3 method for class 'spautor'fitted.values(object, type ="response",...)## S3 method for class 'spglm'fitted(object, type ="response",...)## S3 method for class 'spglm'fitted.values(object, type ="response",...)## S3 method for class 'spgautor'fitted(object, type ="response",...)## S3 method for class 'spgautor'fitted.values(object, type ="response",...)
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).
Returns
The fitted values according to type.
Details
When type is "response", the fitted values for each observation are the standard fitted values Xβ^. 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
spmod <- splm(z ~ water + tarp, data = caribou, spcov_type ="exponential", xcoord = x, ycoord = y
)fitted(spmod)fitted.values(spmod)fitted(spmod, type ="spcov")