Learn R Programming

simex (version 1.0)

extract.covmat: Extracts the covariance matrix

Description

Extracts the covariance matrix from various models and returns them in a way, so that the simex and mcsimex functions can use them.

Usage

extract.covmat(model)

Arguments

model
object of a fitting function

Value

  • covmatcovariance matrix of the supplied model

Details

So far objects of class lm, glm, gam, nls, lme, nlme are supported.

See Also

simex,mcsimex

Examples

Run this code
x <- rnorm(100,0,100)
u <- rnorm(100,0,25)
w <- x+u
y <- x +rnorm(100,0,9)
model <- lm(y~w, x = TRUE, y =TRUE)
extract.covmat(model)
summary(model)$cov.unscaled*summary(model)$sigma^2

Run the code above in your browser using DataLab