Announcement

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

  • Parametric survival analysis with proportional hazard function in R and STATA

    I have a question concerning the coefficients in the two programs, when estimating a proportional hazard model with a Weibull baseline hazard function.

    When using the same dataset i get different coefficients, but almost identical p-values and standard errors.

    Actually, the signs of the coefficients are exactly opposite across the two programs, which can have quite the consequences, if you want to conclude anything.

    I am using it for my bachelor thesis on costumer churn, so instead of uploading manipulated results and data, I have found two videos on Youtube, which does exactly the same with identical data and functions and still gets opposite results.

    Can someone please help?

    Link R: https://www.youtube.com/watch?v=qt2ufTPCWwI
    Link STATA: https://www.youtube.com/watch?v=jg7laENsXSQ
    She introduces parametric estimation around 12 minutes in both.
    Last edited by Kristian Henriksen; 10 Apr 2020, 09:23.

  • #2
    When you run the same model in Stata and R, check that both programs are reporting Weibull estimates in the same metric -- proportional hazards versus accelerated failure time. By default, Stata uses the former, but can also optionally report in AFT metric. Perhaps the R command that you are using is vice versa?

    For a lengthier explanation see my "Survival Analysis" website (easily found via Google)

    Comment


    • #3
      Thank you for the suggestion.

      I think, I have solved it now. The survreg-function in R is using an accelerated failure time model to estimate, and the coefficients is not the directions of the effects on the hazard, but rather logarithms of ratios of survival times, so a positive coefficient means longer survival.

      I believe, one can transform the the coefficient from survreg to be equal to the ones in Stata by multiplying with the negated scale parameter. (At least it does for all the coefficients in my case, and I think, this is also, what the reference for the survreg package says: Kalbfleisch, J. D. and Prentice, R. L., The statistical analysis of failure time data, Wiley, 2002., chapter 2)

      Comment


      • #4
        This was cross-posted using different names on Stack Overflow and Reddit. Our policy on cross-posting is explicit: you are asked to tell us about it. Not doing so is often regarded as discourteous.

        Comment


        • #5
          Sorry, I were not aware of this, I am quite green in this forum.

          My partner and I just figured, that by posting it in several forums, the probability of getting an answer increased, ceteris paribus.

          Comment


          • #6
            Here is an edited version of my comments at https://stackoverflow.com/questions/...12248_61147106 (that's likely to disappear as a closed question with no answers)

            Naturally cross-posting is allowed. The issue is this. People who post answers don't want to waste their time if someone else posted as good or better an answer elsewhere. People interested in your question would surely want to know about answers elsewhere. Telling people about cross-posting lets either group know what you have done. It's polite to tell us about it.

            I have seen people regard cross-posting as offensive because supposedly you're implying that you don't trust people on any forum to come up with an answer and you don't care two hoots about people wasting their time so long as you get an answer somewhere. Telling people about cross-posting is redundant if and only if all competent and interested people watch all possible forums, which isn't the case.

            Statalist explains its policies, so not knowing about them means that you didn't read its FAQ Advice, which is its explicit request. Otherwise cross-posting on other forums has been discussed on SO Meta, although that is harder to find.



            community.rstudio.com/t/faq-is-it-ok-if-i-cross-post/5218 is a posting which shows the same attitude with the same explanations. It's not just me!

            Comment

            Working...
            X