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.
4
-
$\begingroup$ See also If a factor variable is to be dropped in model selection, should all levels be dropped simultaneously?, Regression with categorical predictors - use only some dummy variables, Is it advisable to drop certain levels of a categorical variable?, & What to do with dummy variable that is not significant? $\endgroup$ – Scortchi - Reinstate Monica♦ Jan 18 '16 at 8:17
-
$\begingroup$ @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. $\endgroup$ – Chirayu Chamoli Jan 18 '16 at 8:57
-
$\begingroup$ There are various ways, but programming questions are off topic here. Look on Stack Overflow, e.g. 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? & Logistic regression: if only some classes of a categorical variable appear significant too if you need more convincing. $\endgroup$ – Scortchi - Reinstate Monica♦ Jan 18 '16 at 9:13
-
$\begingroup$ @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. $\endgroup$ – Chirayu Chamoli Jan 18 '16 at 9:52
Add a comment
|