Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Glitch in calculating relative risks using xtgee

    Hello all,

    I am having a problem calculating relative risks using the xtgee command (to account for clustering of variation owing to repeated measurements within a set of health facilities).

    The command I am entering looks something like this, where _exposure_ indicates the time period (1=follow-up, 0=baseline) and _direct_ indicates the behavior (1=correct, 0=incorrect):

    . xtgee direct exposure, i(group2) fam(bin) link(log) corr(exc) eform

    What I get is a different relative risk than if I used:

    . cs direct exposure

    I suspect that xtgee us using the _exposure_ variable as the dependent variable. I'm not sure though. Is a conversion to a risk ratio not happening?

    Apologies in advance if this is a simple matter that I'm missing.

    Thanks.










  • #2
    cs gives risk ratios while your xtgee command gives odds ratios - those are different things

    Comment


    • #3
      That is very true, I should've looked at the manual. Thanks Rich.

      Comment


      • #4
        xtgee is not using the exposure variable as the dependent variable. And xtgee . . ., family(binomial) link(log) eform does give risk ratio (in the lines before the comment in the output below, compare its point estimate with those for cs and glm; glm even labels the coefficient "Risk Ratio").

        The difference is probably due to the working correlation structure. Try using corr(independent) and see whether the marginal risk ratio estimate then matches that of cs.

        .ÿversionÿ14.0

        .ÿ
        .ÿclearÿ*

        .ÿsetÿmoreÿoff

        .ÿ
        .ÿsysuseÿauto
        (1978ÿAutomobileÿData)

        .ÿ
        .ÿsummarizeÿgear_ratio,ÿmeanonly

        .ÿgenerateÿbyteÿexposureÿ=ÿgear_ratioÿ>ÿr(mean)

        .ÿ
        .ÿsummarizeÿrep78,ÿmeanonly

        .ÿquietlyÿreplaceÿrep78ÿ=ÿr(max)ÿ+ÿ1ÿifÿmi(rep78)

        .ÿ
        .ÿcsÿforeignÿexposure

        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿexposureÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿExposedÿÿÿUnexposedÿÿ|ÿÿÿÿÿÿTotal
        -----------------+------------------------+------------
        ÿÿÿÿÿÿÿÿÿÿÿCasesÿ|ÿÿÿÿÿÿÿÿ21ÿÿÿÿÿÿÿÿÿÿÿ1ÿÿ|ÿÿÿÿÿÿÿÿÿ22
        ÿÿÿÿÿÿÿÿNoncasesÿ|ÿÿÿÿÿÿÿÿ14ÿÿÿÿÿÿÿÿÿÿ38ÿÿ|ÿÿÿÿÿÿÿÿÿ52
        -----------------+------------------------+------------
        ÿÿÿÿÿÿÿÿÿÿÿTotalÿ|ÿÿÿÿÿÿÿÿ35ÿÿÿÿÿÿÿÿÿÿ39ÿÿ|ÿÿÿÿÿÿÿÿÿ74
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
        ÿÿÿÿÿÿÿÿÿÿÿÿRiskÿ|ÿÿÿÿÿÿÿÿ.6ÿÿÿÿÿ.025641ÿÿ|ÿÿÿ.2972973
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿPointÿestimateÿÿÿÿ|ÿÿÿÿ[95%ÿConf.ÿInterval]
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|------------------------+------------------------
        ÿRiskÿdifferenceÿ|ÿÿÿÿÿÿÿÿÿÿ.574359ÿÿÿÿÿÿÿ|ÿÿÿÿ.4046466ÿÿÿÿ.7440713ÿ
        ÿÿÿÿÿÿRiskÿratioÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿ23.4ÿÿÿÿÿÿÿ|ÿÿÿÿ3.317608ÿÿÿÿ165.0466ÿ
        ÿAttr.ÿfrac.ÿex.ÿ|ÿÿÿÿÿÿÿÿÿÿ.957265ÿÿÿÿÿÿÿ|ÿÿÿÿÿ.698578ÿÿÿÿ.9939411ÿ
        ÿAttr.ÿfrac.ÿpopÿ|ÿÿÿÿÿÿÿÿÿ.9137529ÿÿÿÿÿÿÿ|
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ+-------------------------------------------------
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿchi2(1)ÿ=ÿÿÿÿ29.13ÿÿPr>chi2ÿ=ÿ0.0000

        .ÿglmÿforeignÿi.exposure,ÿcluster(rep78)ÿfamily(binomial)ÿlink(log)ÿeformÿnolog

        GeneralizedÿlinearÿmodelsÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNo.ÿofÿobsÿÿÿÿÿÿ=ÿÿÿÿÿÿÿÿÿ74
        Optimizationÿÿÿÿÿ:ÿMLÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿResidualÿdfÿÿÿÿÿ=ÿÿÿÿÿÿÿÿÿ72
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿScaleÿparameterÿ=ÿÿÿÿÿÿÿÿÿÿ1
        Devianceÿÿÿÿÿÿÿÿÿ=ÿÿ56.41207695ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ(1/df)ÿDevianceÿ=ÿÿÿ.7835011
        Pearsonÿÿÿÿÿÿÿÿÿÿ=ÿÿ73.99999999ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ(1/df)ÿPearsonÿÿ=ÿÿÿ1.027778

        Varianceÿfunction:ÿV(u)ÿ=ÿu*(1-u)ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ[Bernoulli]
        Linkÿfunctionÿÿÿÿ:ÿg(u)ÿ=ÿln(u)ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ[Log]

        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿAICÿÿÿÿÿÿÿÿÿÿÿÿÿ=ÿÿÿ.8163794
        Logÿpseudolikelihoodÿ=ÿ-28.20603847ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿBICÿÿÿÿÿÿÿÿÿÿÿÿÿ=ÿÿ-253.4806

        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ(Std.ÿErr.ÿadjustedÿforÿ6ÿclustersÿinÿrep78)
        ------------------------------------------------------------------------------
        ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRobust
        ÿÿÿÿÿforeignÿ|ÿRiskÿRatioÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
        -------------+----------------------------------------------------------------
        ÿÿ1.exposureÿ|ÿÿÿÿÿÿÿ23.4ÿÿÿ25.15352ÿÿÿÿÿ2.93ÿÿÿ0.003ÿÿÿÿÿ2.845954ÿÿÿÿ192.3995
        ÿÿÿÿÿÿÿ_consÿ|ÿÿÿÿ.025641ÿÿÿ.0312609ÿÿÿÿ-3.00ÿÿÿ0.003ÿÿÿÿÿ.0023506ÿÿÿÿ.2797049
        ------------------------------------------------------------------------------

        .ÿxtgeeÿforeignÿi.exposure,ÿi(rep78)ÿfamily(binomial)ÿlink(log)ÿcorr(independent)ÿvce(robust)ÿeformÿnolog

        GEEÿpopulation-averagedÿmodelÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿÿÿÿ74
        Groupÿvariable:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrep78ÿÿÿÿÿÿNumberÿofÿgroupsÿÿ=ÿÿÿÿÿÿÿÿÿÿ6
        Link:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿlogÿÿÿÿÿÿObsÿperÿgroup:
        Family:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿbinomialÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿminÿ=ÿÿÿÿÿÿÿÿÿÿ2
        Correlation:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿindependentÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavgÿ=ÿÿÿÿÿÿÿ12.3
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿmaxÿ=ÿÿÿÿÿÿÿÿÿ30
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWaldÿchi2(1)ÿÿÿÿÿÿ=ÿÿÿÿÿÿÿ8.60
        Scaleÿparameter:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿProbÿ>ÿchi2ÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0034

        Pearsonÿchi2(74):ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ74.00ÿÿÿÿÿÿDevianceÿÿÿÿÿÿÿÿÿÿ=ÿÿÿÿÿÿ56.41
        Dispersionÿ(Pearson):ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿDispersionÿÿÿÿÿÿÿÿ=ÿÿÿ.7623254

        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ(Std.ÿErr.ÿadjustedÿforÿclusteringÿonÿrep78)
        ------------------------------------------------------------------------------
        ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿSemirobust
        ÿÿÿÿÿforeignÿ|ÿÿÿÿÿexp(b)ÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
        -------------+----------------------------------------------------------------
        ÿÿ1.exposureÿ|ÿÿÿÿÿÿÿ23.4ÿÿÿ25.15352ÿÿÿÿÿ2.93ÿÿÿ0.003ÿÿÿÿÿ2.845954ÿÿÿÿ192.3995
        ÿÿÿÿÿÿÿ_consÿ|ÿÿÿÿ.025641ÿÿÿ.0312609ÿÿÿÿ-3.00ÿÿÿ0.003ÿÿÿÿÿ.0023506ÿÿÿÿ.2797049
        ------------------------------------------------------------------------------

        .ÿ
        .ÿ*
        .ÿ*ÿTheÿdifferenceÿisÿinÿtheÿworkingÿcorrelationÿstructure
        .ÿ*
        .ÿxtgeeÿforeignÿi.exposure,ÿi(rep78)ÿfamily(binomial)ÿlink(log)ÿcorr(exchangeable)ÿeformÿnolog

        GEEÿpopulation-averagedÿmodelÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿÿÿÿ74
        Groupÿvariable:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrep78ÿÿÿÿÿÿNumberÿofÿgroupsÿÿ=ÿÿÿÿÿÿÿÿÿÿ6
        Link:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿlogÿÿÿÿÿÿObsÿperÿgroup:
        Family:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿbinomialÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿminÿ=ÿÿÿÿÿÿÿÿÿÿ2
        Correlation:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿexchangeableÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavgÿ=ÿÿÿÿÿÿÿ12.3
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿmaxÿ=ÿÿÿÿÿÿÿÿÿ30
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWaldÿchi2(1)ÿÿÿÿÿÿ=ÿÿÿÿÿÿÿ5.99
        Scaleÿparameter:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿProbÿ>ÿchi2ÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0144

        ------------------------------------------------------------------------------
        ÿÿÿÿÿforeignÿ|ÿÿÿÿÿexp(b)ÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
        -------------+----------------------------------------------------------------
        ÿÿ1.exposureÿ|ÿÿÿ11.51268ÿÿÿ11.49386ÿÿÿÿÿ2.45ÿÿÿ0.014ÿÿÿÿÿÿ1.62692ÿÿÿÿ81.46789
        ÿÿÿÿÿÿÿ_consÿ|ÿÿÿ.0465222ÿÿÿ.0516089ÿÿÿÿ-2.77ÿÿÿ0.006ÿÿÿÿÿ.0052892ÿÿÿÿ.4091964
        ------------------------------------------------------------------------------

        .ÿxtgeeÿforeignÿi.exposure,ÿi(rep78)ÿfamily(binomial)ÿlink(log)ÿcorr(exchangeable)ÿvce(robust)ÿeformÿnolog

        GEEÿpopulation-averagedÿmodelÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿÿÿÿ74
        Groupÿvariable:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrep78ÿÿÿÿÿÿNumberÿofÿgroupsÿÿ=ÿÿÿÿÿÿÿÿÿÿ6
        Link:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿlogÿÿÿÿÿÿObsÿperÿgroup:
        Family:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿbinomialÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿminÿ=ÿÿÿÿÿÿÿÿÿÿ2
        Correlation:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿexchangeableÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavgÿ=ÿÿÿÿÿÿÿ12.3
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿmaxÿ=ÿÿÿÿÿÿÿÿÿ30
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWaldÿchi2(1)ÿÿÿÿÿÿ=ÿÿÿÿÿÿÿ4.56
        Scaleÿparameter:ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿProbÿ>ÿchi2ÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0328

        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ(Std.ÿErr.ÿadjustedÿforÿclusteringÿonÿrep78)
        ------------------------------------------------------------------------------
        ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿSemirobust
        ÿÿÿÿÿforeignÿ|ÿÿÿÿÿexp(b)ÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
        -------------+----------------------------------------------------------------
        ÿÿ1.exposureÿ|ÿÿÿ11.51268ÿÿÿ13.17796ÿÿÿÿÿ2.13ÿÿÿ0.033ÿÿÿÿÿ1.221378ÿÿÿÿ108.5182
        ÿÿÿÿÿÿÿ_consÿ|ÿÿÿ.0465222ÿÿÿ.0571153ÿÿÿÿ-2.50ÿÿÿ0.012ÿÿÿÿÿ.0041941ÿÿÿÿ.5160374
        ------------------------------------------------------------------------------

        .ÿ
        .ÿexit

        endÿofÿdo-file


        .


        Comment

        Working...
        X