Announcement

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

  • Standard error from strs for relative survival

    Hi everyone,

    Anyone has ever done "strs" to calculate the relative survival in Stata may help me through this.

    According to this formula :
    /* SE of P */
    gen var_Lambda=(end-start)^2*d/y^2
    gen se_p=p*sqrt(var_Lambda)

    /* SE of CP */
    `byby' gen var_cLambda=sum( (end-start)^2*d/y^2 )
    gen se_cp=cp*sqrt(var_cLambda)

    I try to work out the standard error based on the N, d, y , p and cp. However, I don't get the same result as strs. Please see the example below.

    This results from strs
    sex start end n d d_star y p p_star cp cp_e2 se_p se_cp se_cr_e2
    1 0 1 78093 13010 1370.5 58393.9 0.8003 0.9754 0.8003 0.9754 0.0016 0.0016 0.0016
    1 1 2 61430 5081 1155.9 48837.8 0.9012 0.9763 0.7212 0.9523 0.0013 0.0018 0.0018
    1 2 3 53310 3065 1069.1 43264.8 0.9316 0.9755 0.6719 0.9289 0.0012 0.0019 0.002
    1 3 4 47797 2295 1011.4 38931 0.9428 0.9742 0.6334 0.905 0.0012 0.0019 0.0021
    1 4 5 42780 1907 946.4 34737.4 0.9466 0.9729 0.5996 0.8805 0.0012 0.002 0.0022
    2 0 1 58176 8218 621.2 44263.9 0.8306 0.9846 0.8306 0.9846 0.0017 0.0017 0.0017
    2 1 2 47425 3162 524.2 38082.1 0.9203 0.9861 0.7644 0.9709 0.0014 0.0019 0.002
    2 2 3 42485 1948 486.8 34477.8 0.9451 0.9858 0.7224 0.9572 0.0012 0.002 0.0021
    2 3 4 38479 1407 464.3 31496.8 0.9563 0.9853 0.6908 0.9431 0.0011 0.0021 0.0022
    2 4 5 35215 1204 439.4 28760.5 0.959 0.9848 0.6625 0.9288 0.0012 0.0022 0.0024
    This is my working
    sex start end n d d_star y p p_star cp cp_e2 var_Lambda se_p var_cLambda se_cp
    1 0 1 78093 13010 1370.5 58393.9 0.8003 0.9754 0.8003 0.9754 3.81542E-06 0.0016 3.81542E-06 0.0026
    1 1 2 61430 5081 1155.9 48837.8 0.9012 0.9763 0.7212 0.9523 2.13028E-06 0.0013 2.13028E-06 0.0024
    1 2 3 53310 3065 1069.1 43264.8 0.9316 0.9755 0.6719 0.9289 1.63742E-06 0.0012 1.63742E-06 0.0022
    1 3 4 47797 2295 1011.4 38931 0.9428 0.9742 0.6334 0.905 1.51423E-06 0.0012 1.51423E-06 0.0021
    1 4 5 42780 1907 946.4 34737.4 0.9466 0.9729 0.5996 0.8805 1.58036E-06 0.0012 1.58036E-06 0.0020
    2 0 1 58176 8218 621.2 44263.9 0.8306 0.9846 0.8306 0.9846 4.19437E-06 0.0017 4.19437E-06 0.0027
    2 1 2 47425 3162 524.2 38082.1 0.9203 0.9861 0.7644 0.9709 2.18032E-06 0.0014 2.18032E-06 0.0025
    2 2 3 42485 1948 486.8 34477.8 0.9451 0.9858 0.7224 0.9572 1.63874E-06 0.0012 1.63874E-06 0.0024
    2 3 4 38479 1407 464.3 31496.8 0.9563 0.9853 0.6908 0.9431 1.41828E-06 0.0011 1.41828E-06 0.0023
    2 4 5 35215 1204 439.4 28760.5 0.959 0.9848 0.6625 0.9288 1.45557E-06 0.0012 1.45557E-06 0.0022
    Has anyone got a clue, please help me.

    Thanks
    Last edited by Nancy; 06 Jul 2015, 23:02.

  • #2
    Nancy,

    I think what you have labelled var_cLambda is actually var_Lambda, i.e. when you calculate the the standard error of cumulative survival you need the variance of the cumulative hazard.

    Also note by default strs will use the actuarial method to calculate standard errors when there is not delayed entry and use the hazard based approach when there is delayed entry. See here for details on calculation of standard errors (http://www.pauldickman.com/rsmodel/s...ard_errors.pdf).

    Paul

    Comment


    • #3
      Hi Paul, thanks for replying my query. Is there any alternative way to work out se_cp without looking at delayed entry because I did not retain the delayed entry flag in final output.

      Comment


      • #4
        Nancy,

        When there delayed entry you strs uses the hazard based approach, so the standard error in your example is,


        Code:
        bysort sex: gen var_cLambda=sum((end-start)^2*d/y^2)
        gen se_cp=cp*sqrt(var_cLambda)
        strs takes care of using the correct number of deaths (d) and person years (y) within each interval through the information given when you stset the data.

        Paul

        Comment


        • #5
          Thanks Paul.

          Is there any alternative way to work out se_cp without looking at delayed entry because I did not retain the delayed entry flag in final output.
          I'm not quite sure what you mean by this, but as Paul Lambert said the formulae are in the document he referenced. If you do not have late entry (meaning -strs- uses actuarial approach and Greenwood's method by default) then you can force -strs- to instead use the hazard transformation approach (which is the default for late entry) by specifying the -ht- option.

          In your worked example, the SE of both P and CP for the first interval is given by:

          Code:
          . di 0.8003*sqrt(13010/58393.9^2)
          .00156323
          Which is the same as reported by -strs-.

          There is a problem with your worked example, but I'll first clarify the terminology.

          var_Lambda is the variance of the cumulative hazard for the interval, among those alive at the start of the interval.
          var_cLambda is the variance of the the cumulative hazard from time zero until the end the interval, among those alive at time zero.

          These appear to be the same in your worked example. That is, you may have left out the 'sum' in the formula for var_cLambda.

          Also, if se_cp is a variable generated by you then it looks like there is an error in the way you created it. Since var_Lambda and var_cLambda are (erroneously) the same in your worked example then se_p and se_cp should also be (erroneously) the same for the first interval (since P and CP are the same for that interval).


          Comment


          • #6
            Hi Paul,

            Yes I left out the cumulative sum for var_cLambda. I think I got it now.

            Thanks Paul.

            Comment


            • #7
              Hi Paul Lambert, Paul Dickman

              I also have another question in which relating to conditional relative survival and I think with your experts may help me answer this.

              I have generally understand that with CS, for example to work out CS 5-year relative survival : RS 6-yr / RS 1yr. I am not sure is this right?.

              How is about the confidence interval of this CS 5-year RS? I would not think that C.I of 6-yr / C.I of 1 yr. Could you show me the steps to work out this C.I or Is there a formula to work out the S.E.

              Thanks again.

              Comment


              • #8
                Please do not ask a question under a topic that has been resolved. Otherwise no-one perusing the list of topics will know that it is indeed a different question and the "new" thread will be difficult to navigate. Please also note that long-standing Statalist etiquette is to register with full real names. Use the CONTACT US.
                Steve Samuels
                Statistical Consulting
                [email protected]

                Stata 14.2

                Comment

                Working...
                X