Announcement

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

  • -margins- after streg command

    Hello

    I am trying to interpret the meaning of -margins- results after a streg command.

    My streg command is as follows:

    streg i.sex i.agegrp, d(exp)

    The hazard ratio for sex group 2 to sex group 1 (females to males) is 1.075545

    I then type:

    margins sex

    This output tells me that the expression is (by default):

    Predicted median _t, predict()

    whereby margin for males is 4959.604 and margin for females is 4611.247

    In my dataset, _t refers to follow-up time for each individual, and the median _t is 1083.

    Could anyone please explain the meaning of "predicted median _t"?

    Thanks for any advice

    Raph

  • #2
    Well, without knowing exactly what commands you used to calculate your median, it's hard to be specific. But I can make some general comments:

    The results you are getting from -margins- are the median survival times predicted by the model. They will not necessarily correspond to what you calculate by taking the median value of _t because

    1. Some values of _t represent censoring times rather than survival times.
    2. Even the median value of _t among those that are not censoring times does not have to correspond to the model predictions because the censored observations affect the probability of survival by changing the denominator as time moves on.
    3. There is no assurance that an exponential model (or any other you might choose) is a good fit to the data.

    To get a good feel for 1 and 2, try the following exercise, do the following:
    Code:
    //    CREATE DATA SET OF TIMES WITH
    //    EXPONENTIAL DISTRIBUTION
    clear*
    set obs 100
    set seed 1234
    gen t = rgamma(1, 5)
    //    BUT HAVE A VERY LARGE NUMBER OF
    //    CENSORED OBSERVATIONS
    gen fail = 0
    replace fail = 1 in 1/10
    
    stset t, failure(fail)
    
    //    GRAPH THE KAPLAN-MEIER SURVIVAL FUNCTION ESTIMATOR
    sts graph
    //    NOTE THAT MEDIAN SURVIVAL HAS NOT YET BEEN REACHED BY
    //    THE END OF THE GRAPH AT 25!
    
    //    CALCULATE MEDIAN VALUES OF _t, OVERALL, AND NON-CENSORED
    centile _t // MEDIAN _t
    centile _t if _d // MEDIAN NON-CENSORING _t
    
    //    FIT EXPONENTIAL SURVIVAL MODEL
    streg, d(exp)
    //    GET MODEL PREDICTION OF MEDIAN SURVIVAL
    margins
    //    YOU CAN SEE THAT THIS ESTIMATE SEEMS QUITE
    //    COMPATIBLE WITH THE KAPLAN-MEIER GRAPH AS
    //    THE ESTIMATED MEDIAN IS WELL BEYOND 25
    //    AND IT IS CLEARLY NOWHERE NEAR ANY OBSERVED
    //    VALUE OF _t

    Comment


    • #3
      Thanks for your reply and attached example, which I have been through. Apologies but I am still struggling to understand this.

      My approach to comparing mortality rates for males vs females is, firstly, to go:

      strate sex

      This gives me the (unadjusted) mortality rate for each sex. I have already successfully -stset- my data before doing this.

      I then go:

      streg i.sex, d(exp)

      This gives me the (unadjusted) mortality rate ratio for females to males.

      I then go:

      streg i.sex i.agegrp, d(exp)

      This gives me the mortality rate ratio for females to males, now adjusted for agegroup. (I'm only interested in agegroup as a confounder)

      I would now like to obtain the agegroup-adjusted rates for males and females, so that I can say things like "the mortality rate, after adjusting for agegroup, was X for women and Y for men".

      I was hoping I could achieve this simply by typing:

      margins sex

      after my -streg- command, but that doesn't seem to get me there.

      Any further help very much appreciated!

      Comment


      • #4
        After -streg-, the defalt output of -margins- is the median survival time. -streg- covers a wide variety of parametric survival models, and the exponential is the only one among them which defines a unique time-invariant mortality rate. So -streg-'s postestimation commands do not in general calculate mortality rates, as they are ill-defined. I think your best approach here is to rely on the fact that in the exponential survival model, the mortality rate is the reciprocal of the mean survival time. So -margins sex, expression(1/(predict mean time))- will, I think, get you what you want.

        Comment


        • #5
          This is extremely helpful, thanks very much Clyde

          Comment


          • #6
            I am using this command for my study :svy, subpop(touse) :streg i.birth_cohort i.bmi3 i.sex i.por_binary i.education i.mpce_new5 i.caste i.religion i.ms i.living_arrangement i.region i.work_status i.hinsu i.smoke i.alcohol_use , d(weibull)
            after this i used th following command which is not working : margins, dydx(birth_cohort bmi3 sex por_binary education mpce_new5 religion ms living_arrangement region work_status hinsu smoke alcohol_use) post
            est sto wbm
            to plot coeffplot using wbm. please help Clyde Schechter

            Comment

            Working...
            X