[R] Discriminant function analysis
Tyler Smith
tyler.smith at mail.mcgill.ca
Thu Feb 7 14:21:58 CET 2008
On 2008-02-07, Birgit Lemcke <birgit.lemcke at systbot.uzh.ch> wrote:
>
> Am 06.02.2008 um 21:00 schrieb Tyler Smith:
>>
>>> My dataset contains variables of the classes factor and numeric. Is
>>> there another function that is able to handle this?
>>
>> The numeric variables are fine. The factor variables may have to be
>> recoded into dummy binary variables, I'm not sure if lda() will deal
>> with them properly otherwise.
>
> But aren´t binary variables also factors? Or is there another
> variable class than factor or numeric?
> Do I have have to set the classe of the binaries as numeric?
>
There is no binary class in R, so you would have to use a numeric
field. For example:
| sample | factor_1 |
|--------+----------|
| A | red |
| B | green |
| C | blue |
becomes:
| sample | dummy_1 | dummy_2 |
|--------+---------+---------|
| A | 1 | 0 |
| B | 0 | 1 |
| C | 0 | 0 |
R can deal with dummy_1 and dummy_2 as numeric vectors. The details
should be explained in a good reference on multivariate statistics
(I'm looking at Legendre and Legendre (1998) section 1.5.7 and 11.5).
HTH,
Tyler
More information about the R-help
mailing list