[R] (no subject)

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue May 18 18:07:25 CEST 2010


One last thing:

before you take my advice on how to recode your nominal/categorical
"clay" variable for your regression model, take some time to see how
other people talk about this and do some searching on phrases like
"regression model with nominal variables" (that's just the one I
used).

You'll find more (and better) advice on how to do it correctly.

-steve

On Tue, May 18, 2010 at 11:54 AM, Steve Lianoglou
<mailinglist.honeypot at gmail.com> wrote:
> Hi,
>
> Sorry, I'm not really getting what going on here ... perhaps having
> more domain knowledge would help me make better sense of our question.
>
> In particular:
>
> On Tue, May 18, 2010 at 11:35 AM, Arantzazu Blanco Bernardeau
> <aramucia at hotmail.com> wrote:
>>
>> Hello
>> I have a data array with soil variables (caperf), in which the variable "clay" is factor (as I see entering str(caperf)) . I need to do a regression model, so I need to have arcilla (=clay) as a numeric variable.  For that I have entered
>>
>> as.numeric(as.character(arcilla))
>>
>> and even entering
>>  'as.numeric(levels(arcilla))[arcilla]'
>
> The above code doesn't make sense to me ...
>
> Perhaps cleaning up your question and providing some reproducible
> example we can use to help show you the light (just describing what a
> variable has isn't enough -- give us minimal code we can paste into R
> that reproduces your problem).
>
> Alternatively, depending no what your "levels" mean, you might want to
> recode your data using "dummy variables" (I'm not sure if that's the
> official term) .. this is what I mean:
>
> http://dss.princeton.edu/online_help/analysis/dummy_variables.htm
>
> In your example, let's say you have four levels for "clay" ... maybe
> "soft", "hard", "smooth", "red"
>
> Instead of only using 1 variable with values 1-4, you would recode
> this into 4 variables with values 0,1
>
> So, if one example has a value of "smooth" for clay. Instead of coding it like:
> clay: 3
>
> You would do:
> soft: 0
> hard: 0
> smooth: 1
> red : 0
>
> -steve
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>



-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the R-help mailing list