powered by
Function for selecting variables using linear regression
selectvarlm(y, x, ctr.vif = 10)
A data.frame of selected variables
A vector of a response variable
A data.frame of explanatory variables
A number of VIF threshold
data("obs") data("sample_vars_sda") obs$Cr_ppm <- log(obs$Cr_ppm) krm <- rmvoutlier(obs$Cr_ppm) y <- obs$Cr_ppm[-krm] x <- sample_vars_sda$Elevation[-krm, 1:11] sx <- selectvarlm(y, x)
Run the code above in your browser using DataLab