adjR2: Adjusted R2

Description Usage Arguments Details Value Examples

View source: R/adjR2.R

Description

Computes the adjusted R2 value

Usage

1
adjR2(pred, truth, d)

Arguments

pred

a numeric vector of predicted/fitted values

truth

a numeric vector of true/observed values

d

number of prediction variables used

Details

Uses 2 numeric vectors pred and truth to compute an adjusted R2 value, adjusted by number of parameters

Value

adjusted r2-value

Examples

1
2
3
4
5
#using the ISLR::Credit database for this example
truth <- ISLR::Credit$Limit
reg_model <- lm(ISLR::Credit$Limit~ISLR::Credit$Income + ISLR::Credit$Cards)
pred <- reg_model$fitted.values
adjR2(pred, truth, 2)

frankchien/bmi585flc documentation built on Dec. 20, 2021, 8:51 a.m.