My response var is a binary variable. In the predictor variable i have a type variable with levels as l1,l2,l3,l4. And when i run a logit (glm(redonse ~ type, family = "binomial"), Some levels of type variable turn out to be insignificant. i.e typel2 comes out to be insignificant. So my question is that, could i drop a that level for a variable somehow. ie i drop typel2 (treat typel2 as NULL or so)and then run the glm. i hope the question is clear.
Asked
Active
Viewed 698 times
1
-
See also [If a factor variable is to be dropped in model selection, should all levels be dropped simultaneously?](http://stats.stackexchange.com/q/18745/17230), [Regression with categorical predictors - use only some dummy variables](http://stats.stackexchange.com/q/146351/17230), [Is it advisable to drop certain levels of a categorical variable?](http://stats.stackexchange.com/q/141063/17230), & [What to do with dummy variable that is not significant?](http://stats.stackexchange.com/q/187877/17230) – Scortchi - Reinstate Monica Jan 18 '16 at 08:17
-
@Scortchi: thanks for the link. could i get a code of how to remove a particular level for the factor variable, if at all this is possible. also i understand that it is not advisable to do this, along with the fact this is not a place to ask codes. – Chirayu Chamoli Jan 18 '16 at 08:57
-
There are various ways, but programming questions are off topic here. Look on Stack Overflow, e.g. http://stackoverflow.com/q/16027521/1864816. Many people find the 'recode' function from the 'car' package convenient. Note that the answers to the five questions I linked to generally advise **against** this approach: see [What happens if the full model has the smallest AIC?](http://stats.stackexchange.com/q/18657/17230) & [Logistic regression: if only some classes of a categorical variable appear significant](http://stats.stackexchange.com/q/86872/17230) too if you need more convincing. – Scortchi - Reinstate Monica Jan 18 '16 at 09:13
-
@thanks again, i dont want to reorder, i just want to just keep the level as NULL or something and include the factor variable in the glm call. – Chirayu Chamoli Jan 18 '16 at 09:52