reg.r.squared: R-squared for lm.fit

Description Usage Arguments Examples

View source: R/reg.r.squared.R

Description

Calculate R-squared for the outcome of lm.fit(). This function is built for reg.linreg for higher efficiency only. It can't be used for calculating R-squared in general operation.

Usage

1
reg.r.squared(SSR,SSTO)

Arguments

SSR

:regression sum of squares or explained of squares

SSTO

:total sum of squares

Examples

1
2
3
4
5
6
7
X <- as.matrix(cbind(1,EuStockMarkets[,1:2])) # create the design matrix
Y <- as.data.frame(EuStockMarkets)$FTSE
fit <- lm.fit(x = X, y = Y)
me <- mean(Y)
SSR <- sum((fit$fitted.values - me)^2)
SSTO <- sum((Y - me)^2)
reg.r.squared(SSR,SSTO)

PMmisc documentation built on May 1, 2019, 9:57 p.m.

Related to reg.r.squared in PMmisc...