fitted.SSN2 {SSN2} | R Documentation |
Extract model fitted values
Description
Extract fitted values from fitted model objects. fitted.values
is an alias.
Usage
## S3 method for class 'ssn_lm'
fitted(object, type = "response", ...)
## S3 method for class 'ssn_lm'
fitted.values(object, type = "response", ...)
## S3 method for class 'ssn_glm'
fitted(object, type = "response", ...)
## S3 method for class 'ssn_glm'
fitted.values(object, type = "response", ...)
Arguments
object |
|
type |
|
... |
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 "tailup"
, "taildown"
, "euclid"
,
or "nugget"
the fitted values for each observation
are (generally) the best linear unbiased predictors of the respective 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
"tailup"
, "taildown"
, "euclid"
,
"nugget"
, and "randcov"
can generally be used to check assumptions
for each component of the fitted model object (e.g., check a Gaussian assumption).
If from ssn_glm()
, when type
is "response"
, the fitted values
for each observation are the standard fitted values on the inverse link
scale: g^{-1}
(X \hat{\beta} + \nu
), where g(.)
is a link function,
\beta
are the fixed effects, and \nu
are the spatial and random effects.
Value
The fitted values according to type
.
Examples
# Copy the mf04p .ssn data to a local directory and read it into R
# When modeling with your .ssn object, you will load it using the relevant
# path to the .ssn data on your machine
copy_lsn_to_temp()
temp_path <- paste0(tempdir(), "/MiddleFork04.ssn")
mf04p <- ssn_import(temp_path, overwrite = TRUE)
ssn_mod <- ssn_lm(
formula = Summer_mn ~ ELEV_DEM,
ssn.object = mf04p,
tailup_type = "exponential",
additive = "afvArea"
)
fitted(ssn_mod)
fitted.values(ssn_mod)