[R] regression with categorical nuisance variable

Ista Zahn izahn at psych.rochester.edu
Tue Mar 1 01:31:17 CET 2011


Hi Jon,
Just enter it as a predictor in the model. You almost can't go wrong
with this one. Usually I would caution you to convert your categorical
variables to factors and make sure the contrasts are set how you want
them, but in this case it doesn't matter because there are (I assume)
only two levels of gender, and you don't really care about
interpreting the coefficient anyway.

Best,
Ista

On Mon, Feb 28, 2011 at 7:14 PM, Jonathan DuBois
<jonathan.m.dubois at gmail.com> wrote:
> Hi,
>
> I am new to R, so I am unsure of the formula to set up this analysis.
> I would like to run a linear model with a continuous dependent
> variable (brain volume) and a continuous independent variable (age)
> while controlling for a categorical nuisance variable (gender).
>
> Age and brain volume are correlated.
> There are no gender differences in age but there are significant
> gender differences in brain volume.
> Therefore, I would like to control for gender when assessing the
> association between brain volume and age.
>
> Any help would be very much appreciated.
>
> Jon
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list