lmWithCov: Uses covariance/correlation matrix for calculate OLS

View source: R/lmWithCov.r

lmWithCovR Documentation

Uses covariance/correlation matrix for calculate OLS

Description

Calculate regression coefficients and R^2 for an OLS regression. Could be used with dominanceAnalysis to perform a dominance analysis without the original data.

Usage

lmWithCov(f, x)

Arguments

f

formula for lm model

x

correlation/covariance matrix

Value

coef

regression coefficients

r.squared

R^2 or coefficient of determination

formula

formula provided as parameter

cov

covariance/correlation matrix provided as parameter

Examples

cov.m<-matrix(c(1,0.2,0.3, 0.2,1,0.5,0.3,0.5,1),3,3,
dimnames=list(c("x1","x2","y"),c("x1","x2","y")))
lm.cov<-lmWithCov(y~x1+x2,cov.m)
da<-dominanceAnalysis(lm.cov)

dominanceanalysis documentation built on May 29, 2024, 2:28 a.m.