I have data from human participants in a study. There are more females in the study (60%) and males are older. I have a binary categorical variable $O$. If those who are $True$ for $O$ are older, do I need to correct for sex and/or age? Maybe those $True$ for $O$ contain more men. What concepts or methods should I use to determine this? I'm using R.

• Is your binary categorical variable O your dependent variable? Could you tell us what your model looks like now? Feb 28 '11 at 13:48
• @ashaw: Variable $O$ is the outcome of a number of different laboratory tests. I'm not modeling $O$ as it is categorical. Males who are $True$ for $O$ are older than females who are $True$ for $O$, but this is expected as all males in the cohort are older than females. I want to know if $O$ is only occurring in older males for example. Are older males more likely to be $True$ for $O$? Feb 28 '11 at 14:01
• So if I understand you correctly, the first formula I posted below is inaccurate. $O$ is a covariate in your model and you're using $O$, $Age$, and $Gender$ to model some other outcome $Y$. If that's true, I can try to adjust the answer below. Feb 28 '11 at 14:10
• Feel free to post more information too - you don't necessarily need to provide the specifics of the study, but if you can provide reasonably clear examples there's a good chance somebody can help! Feb 28 '11 at 14:29

Edited several times to reflect comments

I realized I should give an example of what I meant by "what your model looks like now." From what you've said, I'm assuming that $Variant$ or $O$ is your dependent or outcome variable and that you're starting with something like the following:

$Variant = \beta_0 + \beta_1(Female) + \beta_2(Age) + \beta_3(Treatment) + \varepsilon$

Where I've inserted "Treatment" you can also think of any other sort of indicator that may be relevant to you (and in fact, if you're really dealing with experimental data, I would recommend considering something other than regression!)

If that's the case (and assuming you're confident in your sampling methods, data collection procedures, decision to use regression, etc.), then the answers to your questions are in the results of your regression model -- post the results and maybe we can help you interpret them.

If $Variant$ is on the other side of the equation (i.e. if it's a covariate or an independent variable), then you might want to think about interaction terms. They can help you test for associations in your data that are not simply additive.

From your response to my comment above (and below), it sounds like the model might look more like this (I've now replaced all the occurrences of $O$ with $Variant$ just to distinguish $O$ from $\theta$):

$Y = \beta_0 + \beta_1(Female) + \beta_2(Age) + \beta_3(Variant) + \varepsilon$

In that case, I would definitely consider introducing interaction terms between $Age$ and $Variant$ as well as between $Gender$ and $Variant$.

• I thought linear regression required that all variables be continuous (I didn't add the linear regression tag). $O$ represents whether the infection in the participant is a particular variant or not (in the subset of the data in question, all participants are "infected"; some are infected with the variant and are thus $True$ for $O$). So I wanted to determine if all the men with this variant are older because the variant only infects older men or because men in the study are, on average, older than women. $O$ is binary. Feb 28 '11 at 14:12
• Aha, that makes things a little different. The difference between linear and logistic regression stems from nature of your outcome. If the outcome is continuous and distributed reasonably normally, OLS may apply. If the outcome is binary, logistic regression may apply. (I'm not coming down definitely in either case because there can be many other factors worth taking into account when picking a model). Both logistic and OLS models can accommodate binary, categorical, ordinal and continuous covariates. Feb 28 '11 at 14:23
• What does it mean to fit a linear model between a continuous variable ($age$) and a categorical factor ($gender$)? I was using Wilcoxon to investigate continuous versus categorical variables. Feb 28 '11 at 14:47
• @SabreWolfy: Regression models can produce coefficients for continuous, categorical or binary variables. In the case of a binary variable, the results usually provide a coefficient for only one of the values (e.g. $Female = True$) with the other value ($Female = FALSE$) implicitly used as the baseline of comparison. Feb 28 '11 at 15:04
• What sort of outcome variable are you using in this case? Feb 28 '11 at 15:06