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
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
You may try analysis of covariance. But,as you say"There are no gender differences in age ",then why not combine 2 gender's age and ignore the gender? 2011/3/1 Jonathan DuBois <jonathan.m.dubois@gmail.com>> 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@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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]