[R] Reordering a numeric variable
gunter.berton at gene.com
Thu Dec 15 23:32:40 CET 2011
I believe this needs to be posted on general statistical help list
as you appear to have some confusion about how linear regression
works, especially with categorical variables.
might help you with R's way of dealing with the issues that I believe
you're asking about, but it may not make much sense if I'm correct
about your underlying misunderstanding. If I'm wrong, that and perhaps
?C will probably do it for you.
On Thu, Dec 15, 2011 at 1:44 PM, Abraham Mathew <abraham at thisorthat.com> wrote:
> I'm running a linear model in R using the car package.
> I have a variable education, which i have recoded and regrouped to my
> However, R seems to place each element of that variable in alphabetical
> When I am running the model, don't I need the model order from lowest to
> highest to make an inference that
> a one unit change in one variable produced a one unit change in another.
> educ2 = NA
> educ2[educ %in% levels(educ)[c(4,7)]] <- "HS or Some College"
> educ2[educ %in% levels(educ)[1:2]] <- "College Degree"
> educ2[educ %in% levels(educ)[c(3,5)]] <- "Advanced Degree"
> educ2[educ %in% levels(educ)[c(6,8)]] <- "Other"
> educ2 = factor(educ2)
> The above code is how I regrouped the variable. How can I regroup it so
> that it's levels
> are from lowest to highest. What if they're numeric values"
> *Abraham Mathew
> Statistical Analyst
> This or That Media, Inc.
> abraham at thisorthat.com
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Genentech Nonclinical Biostatistics
Internal Contact Info:
More information about the R-help