Hi all, thanks for reading! I'm running discrete-time survival analysis and trying to plot the step-shaped cumulative survival functions (s) after a logit model.
xtlogit event duration, i(ID)
I basically followed what online resources told me to do and run the following commands:
predict hazard, pu0
bysort ID duration: gen hazard_cumulative = sum(1-hazard)
gen s = 1 - hazard_cumulative
twoway line s duration, sort ylab(0(0.1)1) xlab(1(1)5) connect(J)
Somehow there occurs 2 problems:
(1) At each point of connecting the values, the data points of individual observations occur on the x axis, no matter if I specify line/connect. Array
(2) Even if the values of cumulative survival functions are descending across duration(which I checked with tabulate and browse), somehow the shape is not always descending.
Would anyone know the solutions to these problems? Many, many thanks indeed!
Related Posts with Abnormality when plotting discrete-time survival functions
Alternative analyses to xtologit/xtoprobit for score as dependent variable and dummy as independent variableHi everyone, I’m new to Stata (using version 15.1 on Windows 10) and regard my statistical knowledg…
Generate unique ID of 4 digitsHello, My data doesn't have a unique identifier and I want to generate a unique id of each row of 4…
generating a new variable based on industryHi Stata users, I am trying to generate a new variable (Industry_revenue) for the data example show…
Extension files of OUT.file using X-12 ArimaHi, I am a novice user of Stata and in dire need of help. I am studying the monthly beer sales in bo…
Recoding rules based on string variableHello Statalist, I have a particularly unique, perhaps esoteric question. I am attempting to create…
Subscribe to:
Post Comments (Atom)
0 Response to Abnormality when plotting discrete-time survival functions
Post a Comment