r - Function for Logistic Regression Training Set -
r - Function for Logistic Regression Training Set -
i trying create function test logistic regression model developed on training set.
for example
train <- filter(y, folds != i) test <- filter(y, folds == i)
i want able utilize formula different info sets. example, if take y
response variable such “low
” in birthwt info set , x
explanatory variables e.g. “age", “race”
how implement these arguments glm.train formula without having type function separately different info sets ?
glm.train <- glm(y ~x, family = binomial, info = train)
you can utilize reformulate
create formula based on strings:
x <- c("age", "race") y <- "low" form <- reformulate(x, response = y) # low ~ age + race
use formula glm
:
glm.train <- glm(form, family = binomial, info = train)
r logistic-regression
Comments
Post a Comment