covmatrix.SSN2 {SSN2} | R Documentation |
Create a covariance matrix
Description
Create a covariance matrix from a fitted model object.
Usage
## S3 method for class 'ssn_lm'
covmatrix(object, newdata, cov_type, ...)
## S3 method for class 'ssn_glm'
covmatrix(object, newdata, cov_type, ...)
Arguments
object |
|
newdata |
If omitted, the covariance matrix of
the observed data is returned. If provided, |
cov_type |
The type of covariance matrix returned. If |
... |
Other arguments. Not used (needed for generic consistency). |
Value
A covariance matrix (see cov_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, predpts = "CapeHorn", overwrite = TRUE)
ssn_mod <- ssn_lm(
formula = Summer_mn ~ ELEV_DEM,
ssn.object = mf04p,
tailup_type = "exponential",
additive = "afvArea"
)
covmatrix(ssn_mod)
covmatrix(ssn_mod, "CapeHorn")