[R] Dummy variables or factors?
Luciano La Sala
lucianolasala at yahoo.com.ar
Tue Oct 20 22:00:11 CEST 2009
I am analyzing epidemiological data using GLMM using the lmer package. I usually explore the assumption of linearity of continuous variables in the logit of the outcome by creating 4 categories of the variable, performing a bivariate logistic regression, and then plotting the coefficients of each category against their mid points. That gives me a pretty good idea about the linearity assumption and possible departures from it.
I know of people who create 0,1 dummy variables in order to relax the linearity assumption. However, I've read that dummy variables are never needed (nor are desireble) in R! Instead, one should make use of factors variable. That is much easier to work with than dummy variables and the model itself will create the necessary dummy variables.
Having said that, if my data violates the linearity assumption, does the use of a factors for the variable in question helps overcome the lack of linearity?
Thanks in advance,
Encontra las mejores recetas con Yahoo! Cocina.
More information about the R-help