Skip to content
Prev 320087 / 398502 Next

Help on indicator variables

What Bill says, plus the fact that the default handling of logicals in modelling is to convert them to factors and then use treatment contrasts, which will effectively give you the right indicator variables automagically (This in contrast to SAS where you can confuse yourself by declaring a 0/1 variable as a CLASS variable):
Call:
lm(formula = y ~ cond)

Coefficients:
(Intercept)     condTRUE  
    -0.5741       1.1845
Call:
lm(formula = y ~ as.numeric(cond))

Coefficients:
     (Intercept)  as.numeric(cond)  
         -0.5741            1.1845
On Mar 21, 2013, at 15:49 , William Dunlap wrote: