?formula
mentioned that you can use -
to drop term. Here is how:
glm(Vote ~. -ID, data = train, family = binomial)
g = glm(Vote ~. - ID - YOB - ABC, data = train, family = binomial)
Well I might give you some example:
> head(trees) ## this is R's built-in dataset
Girth Height Volume
1 8.3 70 10.3
2 8.6 65 10.3
3 8.8 63 10.2
4 10.5 72 16.4
5 10.7 81 18.8
6 10.8 83 19.7
Now we build a model, dropping Girth
and Height
:
> lm(Volume ~. -Girth - Height, trees)
Call:
lm(formula = Volume ~ . - Girth - Height, data = trees)
Coefficients:
(Intercept)
30.17
Now you see that only intercept is estimated.