reg.adj.r.squared {YRmisc}R Documentation

Adjusted R-squared for lm.fit

Description

Calculate Adjusted 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 Adjusted R-squared in general operation.

Usage

reg.adj.r.squared(r,n,p)

Arguments

r

:R-squared for regression

n

:number of observations aka. sample size

p

:number of explanatory variables in the model

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)
SSR <- sum((fit$fitted.values - mean(Y))^2)
SSTO <- sum((Y - mean(Y))^2)
r <- reg.r.squared(SSR,SSTO)
n <- dim(X)[1]; p <- dim(X)[2]
reg.adj.r.squared(r,n,p)

[Package YRmisc version 0.1.6 Index]