reg.r.squared {YRmisc} | R Documentation |
R-squared for lm.fit
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
reg.r.squared(SSR,SSTO)
Arguments
SSR |
:regression sum of squares or explained of squares |
SSTO |
:total sum of squares |
Examples
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)
[Package YRmisc version 0.1.6 Index]