Skip to contents

Compute R-squared for each variable versus all other covariates

Usage

get_r2(df, type)

Arguments

df

data frame

type

type corresponding to columns in df

Value

A vector with values of R squared of each variable

Details

R-squared is a measure of collinearity, defined as how one variable is linearly associated with all other variables in the data set.

Examples

df <- data.frame(X1 = rnorm(100), X2 = rnorm(100), X3 = rnorm(100))
get_r2j(df, rep("numeric", 3))
#> Error in get_r2j(df, rep("numeric", 3)): could not find function "get_r2j"