Announcement

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

  • Cox regression analysis gives different results in Stata and SPSS

    I have performed a number of Cox regression analyses using Stata 14.2 and SPSS v24 (both in Windows 7) on a given data set comprising 318 individuals measured on approximately 30 variables, with some missing observations. In each Cox analysis, I have included 2 specific explanatory variables. Some of these analyses give identical results using the 2 packages and others give different estimated HRs and p-values, although the conclusions drawn on the basis of the p-values are the same. I note that the number of observations used when the packages give different results are not identical, e.g. 157 in SPSS and 155 in Stata. I also used R as a check and R gave the same results as SPSS. Can anyone explain why I am getting different results in Stata?

  • #2
    Aviva:
    welcome to the list.
    Temptative answer: Stata applies listwise deletion to observations with missing values in any (dependent and/or independent) variables.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Aviva may also take into consideration an information we get from the Stata Manual: "the method for handling tied failures in the calculation of the log partial likelihood (and residuals). breslow is the default".

      Since you have other options, such as efron, perhaps R and SPSS use as "default" a different method to handle ties. To start, I suggest you perform again the - stcox - , this time with the option - efron - after the comma, and compare with R and SPSS.

      Hope that helps.
      Best regards,

      Marcos

      Comment


      • #4
        Thanks, Marcos - I had already tried using efron to handle ties and this didn't alter the results in any substantial way.

        And thanks, Carlo - I believe both SPSS and R used listwise deletion as well as Stata.

        Regards

        Aviva

        Comment


        • #5
          I believe the reason is already pointed out in #3.

          For a demonstration, please take a look at the examples below:

          Code:
          
          . use http://www.stata-press.com/data/r14/kva2.dta
          (Generator experiment)
          
          . stset failtime, failure(failed)
          
               failure event:  failed != 0 & failed < .
          obs. time interval:  (0, failtime]
           exit on or before:  failure
          
          ------------------------------------------------------------------------------
                   12  total observations
                    0  exclusions
          ------------------------------------------------------------------------------
                   12  observations remaining, representing
                   11  failures in single-record/single-failure data
                  896  total analysis time at risk and under observation
                                                          at risk from t =         0
                                               earliest observed entry t =         0
                                                    last observed exit t =       140
          
          . stcox load bearings, nolog vsquish efron
          
                   failure _d:  failed
             analysis time _t:  failtime
          
          Cox regression -- Efron method for ties
          
          No. of subjects =           12                  Number of obs    =          12
          No. of failures =           11
          Time at risk    =          896
                                                          LR chi2(2)       =       24.02
          Log likelihood  =   -7.9776348                  Prob > chi2      =      0.0000
          
          ------------------------------------------------------------------------------
                    _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                  load |   1.538579   .2221181     2.98   0.003     1.159406    2.041758
              bearings |   .0601619   .0708858    -2.39   0.017     .0059758    .6056884
          ------------------------------------------------------------------------------
          */ Now with Breslow method
          . stcox load bearings, nolog vsquish breslow
          
                   failure _d:  failed
             analysis time _t:  failtime
          
          Cox regression -- Breslow method for ties
          
          No. of subjects =           12                  Number of obs    =          12
          No. of failures =           11
          Time at risk    =          896
                                                          LR chi2(2)       =       23.39
          Log likelihood  =    -8.577853                  Prob > chi2      =      0.0000
          
          ------------------------------------------------------------------------------
                    _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                  load |    1.52647   .2188172     2.95   0.003     1.152576    2.021653
              bearings |   .0636433   .0746609    -2.35   0.019     .0063855    .6343223
          ------------------------------------------------------------------------------
          Now, with R:


          coef exp(coef) se(coef) z p
          load 0.4309 1.5386 0.1444 2.98 0.0028
          factor(bearings)1 -2.8107 0.0602 1.1782 -2.39 0.0171


          2.5 % 97.5 %
          load 1.159406042 2.0417579
          factor(bearings)1 0.005975777 0.6056884
          In short, under Efron method, Stata and R give practically the same results.

          With SPSS - guess what? - the values are practically the same as Stata with the Breslow method:

          Variables in the Equation
          B SE Wald df Sig. Exp(B) 95,0% CI for Exp(B)

          load ,423 ,143 8,706 1 ,003 1,526 1,153 2,022
          bearings -2,754 1,173 5,513 1 ,019 ,064 ,006 ,634


          Hopefully that helps to fully clarify the issue.
          Last edited by Marcos Almeida; 01 Apr 2017, 16:44.
          Best regards,

          Marcos

          Comment


          • #6
            Thanks, Marcos. I can see you get the same results with R and Stata. As i mentioned in my original post, I also sometimes get the same results, depending on the variables I am inserting into the model. However, sometimes I don't get the same results even when I try using the Breslow and Efron methods .

            I attach a data file which gives me different results in Stata and R. The dialysis_10 variable indicates the outcome (1 for an event, 0 for no event), DialysisSurvival gives the survival time, and eGFR6progression and NTproBNP6progression are the 2 binary explanatory variables in the model, each coded 1 for present and 0 for absent.

            Note - for some reason i can't upload the file as a Stata data file (dta) so I have uploaded it as an Excel file.

            Best wishes

            Aviva

            Attached Files

            Comment


            • #7
              Hello Aviva,

              Please use the CODE delimiters or install the SSC dataex so as to share data, as recommended in the FAQ. Thank you.
              Best regards,

              Marcos

              Comment


              • #8
                Marcos - apologies for attaching the file incorrectly. As you are probably aware, I'm new to Statlist. I'm now using dataex, as you suggest, to include the data. As it's this particular data set (as well as others but not all) that is creating a problem, I'm including all the results on all 318 patients, rather than just a sample of them.

                Many thanks.

                BW Aviva



                input byte Dialysis_10 double DialysisSurvival byte(eGFR6progression NTproBNP6progression)
                0 4.997260274 . .
                1 0 0 1
                1 .493150685 0 0
                0 83.30958904 0 1
                0 83.14520548 0 1
                0 .690410959 . .
                1 3.090410959 . .
                0 7.561643836 0 1
                0 3.912328767 . .
                1 0 . .
                1 5.128767123 0 1
                0 5.128767123 . .
                0 40.04383562 0 1
                1 16.47123288 0 0
                0 4.339726027 . .
                0 1.446575342 . .
                0 80.58082192 1 0
                0 80.54794521 0 0
                0 3.747945205 . .
                1 22.94794521 0 0
                1 42.11506849 0 1
                1 13.34794521 0 1
                1 4.306849315 0 1
                1 4.832876712 0 1
                1 5.22739726 0 1
                0 .394520548 . .
                1 .032876712 . .
                0 .526027397 . .
                0 77.62191781 0 0
                0 4.010958904 . .
                0 77.16164384 0 0
                0 77.16164384 0 1
                0 9.205479452 . .
                1 1.545205479 0 1
                0 2.926027397 . .
                0 44.31780822 1 0
                0 2.991780822 . .
                0 6.279452055 . .
                0 2.926027397 . .
                0 2.498630137 . .
                1 29.45753425 0 0
                1 0 . 1
                0 74.56438356 0 1
                1 57.83013699 0 0
                1 0 . .
                1 56.41643836 0 0
                0 3.123287671 . .
                0 3.024657534 . .
                0 43.56164384 0 0
                0 72.09863014 0 0
                0 1.676712329 . .
                0 6.542465753 . .
                0 4.536986301 . .
                0 1.84109589 . .
                0 1.742465753 . .
                0 10.75068493 . .
                0 4.208219178 . .
                0 12.42739726 0 1
                0 43.06849315 0 0
                0 7.890410959 0 1
                1 0 . .
                1 52.17534247 . .
                0 1.676712329 . .
                0 1.578082192 . .
                0 3.649315068 . .
                0 65.42465753 0 0
                1 20.38356164 0 0
                0 65.39178082 1 0
                0 65.19452055 0 0
                1 6.904109589 0 1
                0 63.55068493 0 0
                1 1.775342466 0 1
                0 43.06849315 0 1
                1 7.594520548 . .
                0 27.55068493 . .
                0 .98630137 . .
                0 46.09315068 1 0
                0 8.745205479 0 1
                0 62.1369863 0 0
                0 1.150684932 . .
                0 2.235616438 . .
                1 39.68219178 0 1
                1 19.62739726 0 1
                1 1.808219178 0 1
                0 46.45479452 0 0
                0 60.98630137 0 1
                1 0 0 0
                0 60.32876712 0 0
                0 38.36712329 0 0
                1 25.84109589 0 0
                0 7.693150685 . .
                1 .361643836 0 1
                1 2.301369863 0 0
                0 3.156164384 . .
                1 1.545205479 0 1
                0 3.879452055 . .
                0 58.75068493 0 1
                0 58.75068493 0 0
                0 1.643835616 . .
                0 58.22465753 0 0
                0 5.161643836 . .
                0 58.02739726 0 0
                0 2.071232877 . .
                0 57.6 0 0
                0 58.02739726 0 1
                1 2.071232877 . .
                0 56.84383562 0 1
                0 56.84383562 0 0
                0 5.095890411 . .
                0 7.265753425 . .
                0 9.17260274 . .
                0 14.07123288 0 1
                0 5.983561644 . .
                0 5.424657534 . .
                0 55.95616438 1 1
                0 4.832876712 . .
                0 7.430136986 0 1
                0 16.99726027 . .
                0 55.69315068 0 1
                0 1.150684932 . .
                0 3.221917808 . .
                0 55.23287671 0 0
                0 55.23287671 0 0
                0 3.550684932 . .
                0 1.084931507 . .
                0 54.31232877 0 0
                0 2.104109589 . .
                0 54.14794521 0 1
                0 .131506849 . .
                1 13.8739726 0 1
                0 2.893150685 . .
                0 8.712328767 0 1
                0 54.54246575 0 0
                0 53.68767123 0 0
                0 12.62465753 1 0
                0 16.33972603 0 1
                0 26.36712329 0 1
                0 5.983561644 . .
                1 .657534247 0 1
                0 6.115068493 0 0
                0 1.446575342 . .
                0 50.86027397 0 1
                0 .131506849 . .
                0 3.583561644 . .
                0 1.545205479 . .
                0 28.2739726 0 0
                0 2.301369863 . .
                0 49.05205479 0 1
                0 49.24931507 0 1
                0 38.76164384 0 1
                0 49.54520548 . .
                0 1.808219178 . .
                1 17.3260274 0 1
                0 48.32876712 0 1
                0 .920547945 . .
                0 1.479452055 . .
                0 21.17260274 0 .
                0 26.82739726 0 1
                0 1.41369863 . .
                0 9.304109589 0 1
                1 37.77534247 0 0
                0 8.416438356 . .
                0 46.25753425 0 0
                0 2.728767123 . .
                1 29.26027397 0 0
                0 .690410959 . .
                0 .789041096 . .
                0 45.36986301 0 0
                0 1.446575342 . .
                0 45.40273973 0 0
                0 45.69863014 0 1
                0 14.20273973 1 0
                0 46.06027397 0 0
                0 1.282191781 . .
                0 14.26849315 . .
                0 19.16712329 0 1
                0 43.49589041 0 1
                0 2.991780822 . .
                0 43.13424658 0 0
                0 42.90410959 0 1
                0 6.969863014 0 1
                0 42.57534247 0 0
                0 13.93972603 . .
                0 42.18082192 0 0
                0 42.14794521 1 0
                0 6.542465753 . .
                0 44.90958904 0 0
                0 12.32876712 0 0
                0 27.38630137 0 1
                0 41.26027397 0 0
                0 .42739726 . .
                0 6.64109589 . .
                0 3.550684932 . .
                1 11.50684932 . .
                0 41.42465753 0 1
                0 39.84657534 0 1
                0 3.189041096 . .
                0 6.64109589 . .
                1 14.4 0 1
                0 6.838356164 . .
                0 .789041096 . .
                0 6.542465753 . .
                0 4.438356164 . .
                0 2.728767123 . .
                0 8.219178082 0 1
                0 31.69315068 . .
                0 .887671233 . .
                0 1.742465753 . .
                1 6.279452055 0 1
                0 36.85479452 0 1
                0 35.17808219 1 0
                0 2.136986301 . .
                0 35.17808219 0 0
                0 34.78356164 0 1
                0 34.52054795 0 1
                0 35.44109589 0 0
                0 33.8630137 0 1
                0 34.06027397 0 0
                0 3.419178082 . .
                0 16.43835616 0 1
                0 1.545205479 . .
                0 1.117808219 . .
                0 1.183561644 . .
                1 0 0 1
                0 2.597260274 . .
                0 33.17260274 0 0
                0 21.63287671 . .
                0 32.44931507 0 1
                0 33.13972603 0 1
                0 32.67945205 . .
                0 1.873972603 . .
                0 76.43835616 1 0
                0 5.753424658 . .
                0 4.471232877 . .
                0 1.512328767 . .
                0 3.221917808 . .
                0 1.873972603 . .
                0 1.545205479 . .
                0 30.14794521 . .
                0 29.68767123 0 0
                0 7.62739726 . .
                0 29.45753425 . .
                0 27.22191781 . .
                0 29.22739726 0 1
                0 1.742465753 . .
                0 37.57808219 0 1
                0 28.76712329 . .
                0 24.03287671 0 0
                0 1.315068493 . .
                0 1.216438356 . .
                0 4.865753425 . .
                0 28.14246575 0 0
                0 28.8 . .
                0 5.391780822 . .
                0 .887671233 . .
                0 27.45205479 . .
                0 2.005479452 . .
                0 28.10958904 0 0
                0 2.564383562 . .
                0 7.594520548 . .
                0 3.649315068 . .
                1 11.93424658 0 0
                0 26.46575342 . .
                0 5.556164384 . .
                0 26.03835616 0 0
                0 15.15616438 . .
                0 8.712328767 . .
                0 6.378082192 . .
                1 12.85479452 . .
                0 24.88767123 . .
                0 26.03835616 0 1
                0 29.49041096 0 0
                0 24.62465753 0 1
                0 9.534246575 . .
                0 1.446575342 . .
                0 .460273973 . .
                0 .493150685 . .
                0 24 . .
                1 5.22739726 0 1
                0 5.35890411 . .
                0 23.76986301 . .
                0 20.21917808 0 0
                0 23.50684932 . .
                0 25.15068493 0 1
                1 5.556164384 0 1
                0 23.30958904 0 0
                0 23.27671233 0 1
                0 2.531506849 . .
                0 .197260274 . .
                0 2.104109589 . .
                0 22.35616438 0 0
                0 1.709589041 . .
                0 22.1260274 0 0
                0 2.4 . .
                0 1.84109589 . .
                0 21.96164384 0 0
                0 5.030136986 . .
                0 18.54246575 0 0
                1 8.350684932 0 1
                0 5.852054795 . .
                0 21.43561644 0 0
                0 .789041096 . .
                0 21.46849315 . .
                0 21.73150685 0 .
                0 .328767123 . .
                1 16.37260274 0 0
                0 20.74520548 . .
                0 20.54794521 0 0
                1 11.60547945 0 0
                0 1.446575342 . .
                0 20.51506849 0 0
                0 20.51506849 0 1
                0 20.31780822 0 1
                0 2.005479452 . .
                0 1.117808219 . .
                0 19.82465753 1 0
                0 2.202739726 . .
                0 .624657534 . .
                end
                label values Dialysis_10 SPSSDIAL
                label values eGFR6progression EGRF6_0C
                label values NTproBNP6progression V112_A
                [/CODE]

                Comment


                • #9
                  Unfortunately, you didn't present information on the "failure" variable (Dialysis_10 ?) as well as the time variable ("DialysisSurvival"?). The model you shared has only 4 variables (taking one as the time and the other as the event, we have just 2 predictors).

                  Also, you said to have "some missing observations". However, I checked it out: over 50% of missing values for each one of the two predictors.

                  Moreover, if we - list if Dialysis_10 == 1 & eGFR6progression == 1 - we get no observation, and that means a severe difficulty to make predictions...

                  No surprisingly, the confidence interval of GFR6progression reaches infinity.

                  Under such a dismal scenario, the model, as far as I'm concerned, would demand much from the iteration process...

                  And that is what happened: after around 3 dozens of iterations, the output informs it was needed to "refine estimates", albeit the log likelihood didn't change much afterwards.

                  All in all, the data present (severe) problems.

                  Shall you decide to pursue the reasons for different results in your very particular data set (in spite of the clear demonstration in #5 that the results are supposed in R, Stata and SPSS), I kindly recommend to present the command you used for the Cox regression (as well as the stsetting) in Stata.

                  "Exactly", please, as recommend in the FAQ.


                  Best regards,

                  Marcos

                  Comment


                  • #10
                    I have to apologise. I hadn't got the results you got so i checked the data. Unfortunately, when reducing the data to only 4 variables (there are 4 variables - Dialysis_10 is the failure variable, DialysisSurvival is the time variable and there are only 2 predictors, eGFR6progression and NTproBNPprogression), I copied the eGFR variable incorrectly from the larger data set. I now present the correct data set below. I follow this by the commands that i used for the cox regression, together with the stsetting, and the relevant output.

                    Many thanks for your help on this, Marcos

                    BW Aviva




                    input byte Dialysis_10 double DialysisSurvival byte(eGFR6progression NTproBNP6progression)
                    0 4.997260274 . .
                    1 0 0 1
                    1 .493150685 1 0
                    0 83.30958904 0 1
                    0 83.14520548 1 1
                    0 .690410959 . .
                    1 3.090410959 . .
                    0 7.561643836 1 1
                    0 3.912328767 . .
                    1 0 . .
                    1 5.128767123 1 1
                    0 5.128767123 . .
                    0 40.04383562 0 1
                    1 16.47123288 1 0
                    0 4.339726027 . .
                    0 1.446575342 . .
                    0 80.58082192 0 0
                    0 80.54794521 0 0
                    0 3.747945205 . .
                    1 22.94794521 1 0
                    1 42.11506849 0 1
                    1 13.34794521 1 1
                    1 4.306849315 1 1
                    1 4.832876712 1 1
                    1 5.22739726 1 1
                    0 .394520548 . .
                    1 .032876712 . .
                    0 .526027397 . .
                    0 77.62191781 0 0
                    0 4.010958904 . .
                    0 77.16164384 0 0
                    0 77.16164384 0 1
                    0 9.205479452 . .
                    1 1.545205479 1 1
                    0 2.926027397 . .
                    0 44.31780822 0 0
                    0 2.991780822 . .
                    0 6.279452055 . .
                    0 2.926027397 . .
                    0 2.498630137 . .
                    1 29.45753425 0 0
                    1 0 . 1
                    0 74.56438356 0 1
                    1 57.83013699 0 0
                    1 0 . .
                    1 56.41643836 1 0
                    0 3.123287671 . .
                    0 3.024657534 . .
                    0 43.56164384 1 0
                    0 72.09863014 1 0
                    0 1.676712329 . .
                    0 6.542465753 . .
                    0 4.536986301 . .
                    0 1.84109589 . .
                    0 1.742465753 . .
                    0 10.75068493 . .
                    0 4.208219178 . .
                    0 12.42739726 1 1
                    0 43.06849315 1 0
                    0 7.890410959 1 1
                    1 0 . .
                    1 52.17534247 . .
                    0 1.676712329 . .
                    0 1.578082192 . .
                    0 3.649315068 . .
                    0 65.42465753 1 0
                    1 20.38356164 1 0
                    0 65.39178082 0 0
                    0 65.19452055 0 0
                    1 6.904109589 1 1
                    0 63.55068493 0 0
                    1 1.775342466 1 1
                    0 43.06849315 0 1
                    1 7.594520548 . .
                    0 27.55068493 . .
                    0 .98630137 . .
                    0 46.09315068 0 0
                    0 8.745205479 1 1
                    0 62.1369863 0 0
                    0 1.150684932 . .
                    0 2.235616438 . .
                    1 39.68219178 1 1
                    1 19.62739726 0 1
                    1 1.808219178 0 1
                    0 46.45479452 0 0
                    0 60.98630137 1 1
                    1 0 0 0
                    0 60.32876712 0 0
                    0 38.36712329 0 0
                    1 25.84109589 0 0
                    0 7.693150685 . .
                    1 .361643836 0 1
                    1 2.301369863 1 0
                    0 3.156164384 . .
                    1 1.545205479 0 1
                    0 3.879452055 . .
                    0 58.75068493 1 1
                    0 58.75068493 0 0
                    0 1.643835616 . .
                    0 58.22465753 1 0
                    0 5.161643836 . .
                    0 58.02739726 1 0
                    0 2.071232877 . .
                    0 57.6 0 0
                    0 58.02739726 0 1
                    1 2.071232877 . .
                    0 56.84383562 1 1
                    0 56.84383562 0 0
                    0 5.095890411 . .
                    0 7.265753425 . .
                    0 9.17260274 . .
                    0 14.07123288 0 1
                    0 5.983561644 . .
                    0 5.424657534 . .
                    0 55.95616438 0 1
                    0 4.832876712 . .
                    0 7.430136986 0 1
                    0 16.99726027 . .
                    0 55.69315068 0 1
                    0 1.150684932 . .
                    0 3.221917808 . .
                    0 55.23287671 0 0
                    0 55.23287671 0 0
                    0 3.550684932 . .
                    0 1.084931507 . .
                    0 54.31232877 1 0
                    0 2.104109589 . .
                    0 54.14794521 1 1
                    0 .131506849 . .
                    1 13.8739726 0 1
                    0 2.893150685 . .
                    0 8.712328767 0 1
                    0 54.54246575 0 0
                    0 53.68767123 0 0
                    0 12.62465753 0 0
                    0 16.33972603 1 1
                    0 26.36712329 0 1
                    0 5.983561644 . .
                    1 .657534247 0 1
                    0 6.115068493 1 0
                    0 1.446575342 . .
                    0 50.86027397 1 1
                    0 .131506849 . .
                    0 3.583561644 . .
                    0 1.545205479 . .
                    0 28.2739726 0 0
                    0 2.301369863 . .
                    0 49.05205479 0 1
                    0 49.24931507 0 1
                    0 38.76164384 0 1
                    0 49.54520548 . .
                    0 1.808219178 . .
                    1 17.3260274 0 1
                    0 48.32876712 1 1
                    0 .920547945 . .
                    0 1.479452055 . .
                    0 21.17260274 0 .
                    0 26.82739726 0 1
                    0 1.41369863 . .
                    0 9.304109589 0 1
                    1 37.77534247 1 0
                    0 8.416438356 . .
                    0 46.25753425 0 0
                    0 2.728767123 . .
                    1 29.26027397 1 0
                    0 .690410959 . .
                    0 .789041096 . .
                    0 45.36986301 1 0
                    0 1.446575342 . .
                    0 45.40273973 0 0
                    0 45.69863014 1 1
                    0 14.20273973 0 0
                    0 46.06027397 0 0
                    0 1.282191781 . .
                    0 14.26849315 . .
                    0 19.16712329 1 1
                    0 43.49589041 0 1
                    0 2.991780822 . .
                    0 43.13424658 0 0
                    0 42.90410959 1 1
                    0 6.969863014 1 1
                    0 42.57534247 0 0
                    0 13.93972603 . .
                    0 42.18082192 0 0
                    0 42.14794521 0 0
                    0 6.542465753 . .
                    0 44.90958904 0 0
                    0 12.32876712 0 0
                    0 27.38630137 1 1
                    0 41.26027397 0 0
                    0 .42739726 . .
                    0 6.64109589 . .
                    0 3.550684932 . .
                    1 11.50684932 . .
                    0 41.42465753 1 1
                    0 39.84657534 0 1
                    0 3.189041096 . .
                    0 6.64109589 . .
                    1 14.4 1 1
                    0 6.838356164 . .
                    0 .789041096 . .
                    0 6.542465753 . .
                    0 4.438356164 . .
                    0 2.728767123 . .
                    0 8.219178082 1 1
                    0 31.69315068 . .
                    0 .887671233 . .
                    0 1.742465753 . .
                    1 6.279452055 1 1
                    0 36.85479452 0 1
                    0 35.17808219 0 0
                    0 2.136986301 . .
                    0 35.17808219 0 0
                    0 34.78356164 1 1
                    0 34.52054795 0 1
                    0 35.44109589 0 0
                    0 33.8630137 1 1
                    0 34.06027397 0 0
                    0 3.419178082 . .
                    0 16.43835616 0 1
                    0 1.545205479 . .
                    0 1.117808219 . .
                    0 1.183561644 . .
                    1 0 0 1
                    0 2.597260274 . .
                    0 33.17260274 1 0
                    0 21.63287671 . .
                    0 32.44931507 0 1
                    0 33.13972603 0 1
                    0 32.67945205 . .
                    0 1.873972603 . .
                    0 76.43835616 0 0
                    0 5.753424658 . .
                    0 4.471232877 . .
                    0 1.512328767 . .
                    0 3.221917808 . .
                    0 1.873972603 . .
                    0 1.545205479 . .
                    0 30.14794521 . .
                    0 29.68767123 0 0
                    0 7.62739726 . .
                    0 29.45753425 . .
                    0 27.22191781 . .
                    0 29.22739726 1 1
                    0 1.742465753 . .
                    0 37.57808219 0 1
                    0 28.76712329 . .
                    0 24.03287671 1 0
                    0 1.315068493 . .
                    0 1.216438356 . .
                    0 4.865753425 . .
                    0 28.14246575 0 0
                    0 28.8 . .
                    0 5.391780822 . .
                    0 .887671233 . .
                    0 27.45205479 . .
                    0 2.005479452 . .
                    0 28.10958904 0 0
                    0 2.564383562 . .
                    0 7.594520548 . .
                    0 3.649315068 . .
                    1 11.93424658 1 0
                    0 26.46575342 . .
                    0 5.556164384 . .
                    0 26.03835616 1 0
                    0 15.15616438 . .
                    0 8.712328767 . .
                    0 6.378082192 . .
                    1 12.85479452 . .
                    0 24.88767123 . .
                    0 26.03835616 1 1
                    0 29.49041096 0 0
                    0 24.62465753 1 1
                    0 9.534246575 . .
                    0 1.446575342 . .
                    0 .460273973 . .
                    0 .493150685 . .
                    0 24 . .
                    1 5.22739726 1 1
                    0 5.35890411 . .
                    0 23.76986301 . .
                    0 20.21917808 1 0
                    0 23.50684932 . .
                    0 25.15068493 0 1
                    1 5.556164384 1 1
                    0 23.30958904 1 0
                    0 23.27671233 1 1
                    0 2.531506849 . .
                    0 .197260274 . .
                    0 2.104109589 . .
                    0 22.35616438 0 0
                    0 1.709589041 . .
                    0 22.1260274 0 0
                    0 2.4 . .
                    0 1.84109589 . .
                    0 21.96164384 0 0
                    0 5.030136986 . .
                    0 18.54246575 0 0
                    1 8.350684932 1 1
                    0 5.852054795 . .
                    0 21.43561644 1 0
                    0 .789041096 . .
                    0 21.46849315 . .
                    0 21.73150685 0 .
                    0 .328767123 . .
                    1 16.37260274 0 0
                    0 20.74520548 . .
                    0 20.54794521 0 0
                    1 11.60547945 1 0
                    0 1.446575342 . .
                    0 20.51506849 0 0
                    0 20.51506849 0 1
                    0 20.31780822 1 1
                    0 2.005479452 . .
                    0 1.117808219 . .
                    0 19.82465753 0 0
                    0 2.202739726 . .
                    0 .624657534 . .
                    end
                    label values Dialysis_10 SPSSDIAL
                    label values eGFR6progression EGRF6_0C
                    label values NTproBNP6progression V112_A
                    [/CODE]


                    . stset DialysisSurvival, failure(Dialysis_10==1)

                    failure event: Dialysis_10 == 1
                    obs. time interval: (0, DialysisSurvival]
                    exit on or before: failure

                    ------------------------------------------------------------------------------
                    318 total observations
                    7 observations end on or before enter()
                    ------------------------------------------------------------------------------
                    311 observations remaining, representing
                    43 failures in single-record/single-failure data
                    6281.293 total analysis time at risk and under observation
                    at risk from t = 0
                    earliest observed entry t = 0
                    last observed exit t = 83.30959

                    . stcox eGFR6progression NTproBNP6progression

                    failure _d: Dialysis_10 == 1
                    analysis time _t: DialysisSurvival

                    Iteration 0: log likelihood = -168.91379
                    Iteration 1: log likelihood = -161.26733
                    Iteration 2: log likelihood = -161.25931
                    Iteration 3: log likelihood = -161.25931
                    Refining estimates:
                    Iteration 0: log likelihood = -161.25931

                    Cox regression -- Breslow method for ties

                    No. of subjects = 153 Number of obs = 153
                    No. of failures = 36
                    Time at risk = 5179.49589
                    LR chi2(2) = 15.31
                    Log likelihood = -161.25931 Prob > chi2 = 0.0005

                    --------------------------------------------------------------------------------------
                    _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
                    ---------------------+----------------------------------------------------------------
                    eGFR6progression | 3.06671 1.11097 3.09 0.002 1.507682 6.237859
                    NTproBNP6progression | 1.694351 .5945746 1.50 0.133 .8517324 3.370571
                    --------------------------------------------------------------------------------------

                    Comment


                    • #11
                      The number of cases being processed by Stata and SPSS is not same. Data row number 2, 42, 87, 224 (as in your data above) are omitted by Stata but being included in SPSS. If you run the following command in Stata (with nohr option) and run in SPSS without the row, 2, 42, 87, 224 (I suggest to create an id variable to refer them correctly) you will get same result. Stata drops them legitimately because these rows experienced an event before time of risk started (i.e. they have 0 in Dialysissurvival variable), however, SPSS keeps them.

                      Stata output
                      Code:
                      stcox eGFR6progression NTproBNP6progression, nohr
                      
                      No. of subjects =          153                  Number of obs    =         153
                      No. of failures =           36
                      Time at risk    =   5179.49589
                                                                      LR chi2(2)       =       15.31
                      Log likelihood  =   -161.25931                  Prob > chi2      =      0.0005
                      
                      --------------------------------------------------------------------------------------
                                        _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      ---------------------+----------------------------------------------------------------
                          eGFR6progression |   1.120605   .3622677     3.09   0.002     .4105736    1.830637
                      NTproBNP6progression |   .5272996   .3509159     1.50   0.133    -.1604829    1.215082
                      --------------------------------------------------------------------------------------
                      SPSS output without those rows:

                      Code:
                      Variables in the Equation                        
                                 B     SE      Wald   df     Sig.    Exp(B)
                      egfr    1.121    .362    9.569    1    .002    3.067
                      ntpro    .527    .351    2.258    1    .133    1.694


                      Roman

                      Comment


                      • #12
                        Hello Aviva,


                        I believe the reason for the difference between statistical packages, in your specific case, is the number of "invalid" observartions.

                        Code:
                        . list if _st ==0
                        
                             +-----------------------------------------------------------------+
                             | Dialy~10   Dialys~l   eGFR6p~n   NTproB~n   _st   _d   _t   _t0 |
                             |-----------------------------------------------------------------|
                          2. |        1          0          0          1     0    .    .     . |
                         10. |        1          0          .          .     0    .    .     . |
                         42. |        1          0          .          1     0    .    .     . |
                         45. |        1          0          .          .     0    .    .     . |
                         61. |        1          0          .          .     0    .    .     . |
                             |-----------------------------------------------------------------|
                         87. |        1          0          0          0     0    .    .     . |
                        224. |        1          0          0          1     0    .    .     . |
                             +-----------------------------------------------------------------+
                        As you can see, you have several observations "not to be used" in the analysis.

                        Hence, Stata is obliged to eschew those observations. Shall you exclude them when dealing with other packages, the results will be definitely the same!

                        Hopefully that helped.
                        Best regards,

                        Marcos

                        Comment


                        • #13
                          Thanks, Marcos, you are quite right. I had previously checked to see if I got the same results in Stata when i omitted those 7 individuals from the data set - and I did. As you have pointed out, Stata automatically gets rid of the individuals. What I hadn't done is check to see if SPSS and R automatically get rid of them and it seems neither does.

                          Many many thanks for the time you have taken to resolve this.

                          Best wishes

                          Aviva

                          Comment


                          • #14
                            The "wrap up" message is: Stata under - efron - option will present similar results as R. Stata under the default method - breslow - will present similar results as SPSS.

                            Under a misspecified model - such as when there are "events" in spite of the time variable being zero, SPSS doesn't get rid of the "not to be used" observations, whereas Stata dutifully underline them as _st equal to zero and refuses to use them in the estimations.

                            Kudos to Stata
                            Best regards,

                            Marcos

                            Comment


                            • #15
                              Hi!
                              I have the exact same problem. I am using STATA to build a model on data from an RCT, to be validated with new data.

                              The data from the RCT have previously been analyzed in SPSS, and the hazard ratio and confidence interval are published as part of an research article.

                              In STATA, one of the observations are omitted (385 in STATA vs 386 in SPSS) and the hazard ratio and confidence interval are slightly different. I have found the problem by visually inspecting the data, and as described above, Stata drops the data in one of the rows because these row experienced an event before time of risk started.

                              My question is how to produce the same result as SPSS, in STATA?

                              Comment

                              Working...
                              X