Skip to contents

Source: Hedderich, Sachs and Reynarowych, Applied Statistics: Methods Using R, section 8.2.7 "Variable Selection Method", printed page 813, equation (8.38): \(R2_a = 1 - [RSS / (n - (p + 1))] / [SSY / (n - 1)] = 1 - (n - 1)/(n - (p + 1)) (1 - R2)\), with p the number of independent variables excluding the intercept. The point the book makes in giving it: R2 never decreases when a variable is added, so models of different size must be compared on R2_a.

Usage

Radj(n, p, r2 = NULL, rss = NULL, ssy = NULL)

Arguments

n

Number of observations.

p

Number of independent variables, excluding the intercept.

r2

Unadjusted coefficient of determination.

rss, ssy

Residual and total sum of squares, used when r2 is not given; ssy must be positive.

Value

list: radj, r2, n, p, df_resid.

Examples

Radj(20, 2, r2 = 0.8)$radj
#> [1] 0.7764706