[R] calculating an interaction statistic from stratified dat

(Ted Harding) Ted.Harding at manchester.ac.uk
Mon Apr 5 00:26:46 CEST 2010


On 04-Apr-10 22:01:08, Georg Ehret wrote:
> Dear R community,
> I have data on beta&standard error (for the main effect of
> variable x), stratified by sex for my dataset. I wish to
> calculate the sex-interaction effect (as beta&se) from these
> two stratified datasets. Is there a package to do this?
> If not, any advice how to do it manually?
> Thank you very much and best regards, Georg.
> ************************
> Georg Ehret, JHU, Baltimore

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 ------------------------------



More information about the R-help mailing list