Description Usage Arguments Examples
View source: R/reg.adj.r.squared.R
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.
1 | reg.adj.r.squared(r,n,p)
|
r |
:R-squared for regression |
n |
:number of observations aka. sample size |
p |
:number of explanatory variables in the model |
1 2 3 4 5 6 7 8 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.