Re: [R] Matrix of dummy variables from a factor

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Wed 07 Dec 2005 - 09:39:46 EST


On 06-Dec-05 Berton Gunter wrote:
> But note: There are (almost?) no situations in R where the dummy
> variables coding is needed. The coding is (almost?) always handled
> properly by the modeling functions themselves.
>
> Question: Can someone provide a "straightforward" example where the
> dummy variable coding **is** explicitly needed?

Perhaps not particularly straightforward, but if you are using package 'mix' for multiple imputation where some variables are categorical and some continuous, the functions

  ecm.mix

  dabipf.mix

both take a paremeter "design" which is a design matrix expressing dependency of the continuous variables on the categoricals.

The R function 'model.matrix' is useful for obtaining this matrix.

Best wishes,
Ted.



E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 06-Dec-05                                       Time: 22:39:44
------------------------------ XFMail ------------------------------

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 07 09:45:30 2005

This archive was generated by hypermail 2.1.8 : Wed 07 Dec 2005 - 14:28:03 EST