Description Usage Arguments Value Examples
View source: R/backward_selection.R
Perform Backward selection on regression models
1 2 3 4 5 6 7 8 9 10 11 12 13 |
data |
input Data used for the regression |
qvarlist |
Variable list in vector format, including all the variables needed for the quadratic form |
lvarlist |
Variable list in vector format, including all the variables in the continuous linear form |
spvarlist |
variable list in vector format, including all the variables for the spline form |
spclist |
if spvarlist is not empty, specify the outpoints for the spline term |
catvarlist |
variable list in the vector format, including all the categorical variables |
outcome |
Outcome variable for the regression model |
type |
type of regression model, default is lm, logistic regression use type="logistic" |
sig |
significant level used for exit the model, default is 0.05 |
complete_case |
whether to use the complete case for all the variables in the model, default is TRUE |
track |
Whether print the selection process, could select from "Simple","All", "None" |
a list of original formula, final fit model and final fit formula
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Load NHANES DATA
library(NHANES)
data("NHANES")
data=NHANES
#Created variable lists for the model selection
qvarlist<-c("BPSysAve","SleepHrsNight","TotChol")
lvarlist<-c("Age","BPDiaAve","Weight","Height")
spvarlist<-c("Pulse","DirectChol")
spclist<-c(70,1.2)
catvarlist<-c("Depressed","Marijuana","Gender")
#Run the model selection, this will return a list
fit_test1=BWselection(data=NHANES,qvarlist=qvarlist,lvarlist=lvarlist,spvarlist=spvarlist,
spclist=spclist,catvarlist=catvarlist,outcome="BMI",type="lm",sig=0.05,complete_case=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.