Learn R Programming

evolqg (version 0.3-4)

CalculateMatrix: Calculate Covariance Matrix from a linear model fitted with lm()

Description

Calculates covariance matrix using the maximum likelihood estimator and the model residuals.

Usage

CalculateMatrix(linear.m)

Value

Estimated covariance matrix.

Arguments

linear.m

Linear model adjusted for original data.

Author

Diogo Melo, Fabio Machado

References

https://github.com/lem-usp/evolqg/wiki/

Examples

Run this code
data(iris)
old <- options(contrasts=c("contr.sum","contr.poly"))
iris.lm = lm(as.matrix(iris[,1:4])~iris[,5])
cov.matrix <- CalculateMatrix(iris.lm)
options(old)  

#To obtain a corrlation matrix, use:
cor.matrix <- cov2cor(cov.matrix)

Run the code above in your browser using DataLab