Skip to content

calculating an interaction statistic from stratified data

3 messages · Georg Ehret, Alvarez, Joann Marie, (Ted Harding)

#
Hi Georg,

Instead of stratifying by sex, use all your data together to fit one model that controls for sex. This gives you more power because of the increased sample size. Also, this way you can add an interaction term, which is what you are looking for. The gender variable should be defined as a factor. Here's an example:

dataframe$sex <- factor(dataframe$sex)

awesomemodel <- lm(outcomevariable ~ sex + x + sex*x, data = dataframe)

Hope this helps,

JoAnn
#
On 04-Apr-10 22:01:08, Georg Ehret wrote:
If you have the full original data, then you should simply be
able to write a [generalised] linear model with sex-interaction.
For example (e.g. binary outcome and logistic regression, with
two independent variables X1 and X2, therefore a beta for each
of X1 and X2, and also Sex as a factor)

  summary(glm(Y ~ X1*Sex + X2*Sex, family=binomial)$coef

should give you what

However, if (as your wording suggests) all you have is the
beta & SE results by Sex, i.e. you have

  betaM, SE.betaM ; betaF, SE.betaF

then it should be straightforward. The interaction is the
difference between the two betas:

  beta:Sex = betaM - betaF

and (reasoning that Sex differentiates individuals, so the
results for the Sex=M individuals should be independent of
the results for the Sex=F individuals -- unless the two sexes
have some influence on each other ... ), the variance of
beta:Sex = betaM - betaF will be the sum of the variances
of betaM and betaF:

  SE(beta:Sex) = sqrt(SE.betaM^2 + SE.betaF^2)

However, if the two sexes do have an influence on each other
(e.g. your original data are on incidence of a sexually
transmitted disease, and you cannot exclude that some of
the Ms were in contact with some of the Fs), then the above
will not be valid, since the Ys for the Ms could be correlated
with the Ys for the Fs.

But in that case you should perhaps be thinking of a more
elaborate model (and you would certianly need the full original
data -- just the beta's and SE's from the two sexes will not
be sufficient).

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 04-Apr-10                                       Time: 23:26:37
------------------------------ XFMail ------------------------------