Announcement

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

  • stset with _weights - logrank option not allowed

    Hello there

    I would like to use my survival analysis with weights. However stata won't allow me to run my univariate analysis logrank test.
    Previously this was possible without the attweight variable

    Code:
    stset survival [pw=attweight], failure(revised==1) //no problems here
    
    sts test gender, logrank
    Stata returns:
    option logrank not allowed

    However, it is able to continue processing the below:

    Code:
    sts graph, by(gender)
    stphplot, by(gender) nongegative nolntime
    stcoxkm, by(gender)
    
    //Subsequently with a plan to run
    stcox var 1 var2 var3, nohr
    I don't particularly need the logrank test, as I have the graphs,

    I found the below in stata help

    If you have sample weights (if you specified pweights when you stset the data), you cannot run the log-rank or Wilcoxon tests. The Cox regression model, however, has been generalized to sample-weighted data, and Stata’s stcox can fit models with such data. In sample-weighted data, the likelihood-ratio statistic is no longer appropriate, but the Wald test based on the robust estimator of variance is



    Questions:
    1. Why can I not run log rank stat and why does stata help say 'it is no longer appropraite'
    Last edited by Rose Matthews; 09 Nov 2023, 07:20.
Working...
X