[R] Matrix of dummy variables from a factor

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Tue Dec 6 23:39:46 CET 2005


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 at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 06-Dec-05                                       Time: 22:39:44
------------------------------ XFMail ------------------------------




More information about the R-help mailing list