What is the least painful way to do the following in R? We want to run a model with a formula like this:
Model #1: Speed ~ male + female
Unfortunately, our data frame has just a single column, Gender, which has levels 'female', 'male', and 'unknown'. We could then write a formula like this:
Model #2: Speed ~ Gender
However, we don't want to treat 'unknown' as its own gender value. We want the model's semantics to be such that the 'unknown' rows will comprise the baseline for the model, and then the effects of the 'male' and 'female' variables will go on top of that. We do NOT want to simply select a subset of rows that are either 'female' or 'male' and run model #2; we need to include the 'unknown' levels as baseline. How can this be done?
(I understand rearranging the data frame would allow for running model #1. Assume for the moment that this is not feasible.)
Thanks!
Genderfactor). I wonder therefore whether you are accurately communicating your question. Could you perhaps tell us in words what these models mean to you? – whuber♦ Jul 23 '12 at 16:07'unknown'as its own gender value" and "we need to include the'unknown'levels as baseline" comments. If the'unknown's are included, how can they be included but as their own category? – Brian Diggs Jul 23 '12 at 16:20