I need to plot baseline hazard functions for a piecewise constant model. The problem I find is that the hazard needs to be constant in each interval, and then have discrete changes between intervals, which I am not able to achieve.
The code I am using is the following:
streg e1 e2 e3 e4 log_trabalhadores innovator1 exporter1 i. ano i.region, dist(exp) nolog vce(cluster NPC_FIC) nocons
mat b = e(b)
mat list b
scalar n = colsof(b) - 1
scalar list n
mat b =b[1,2...n]
mat score xb = b
ge h=exp(_b[e1]) if age==1
replace h=exp(_b[e2]) if (age>1 & age<=4)
replace h=exp(_b[e3]) if (age>=5 & age<=6)
replace h=exp(_b[e4]) if age>=7
twoway(connect h age, sort )
However, when I do obtain the graph, the "jumps" in between the 4 different periods I have defined are not discrete. How can I make it so that they are? Am I doing something fundamentally wrong?
Related Posts with Baseline hazard function for Piecewise constant model
Industry/Year Fixed Effects (Panel Data)Hi, Let me first say that I'm Stata-beginner and would appreciate your help. I have read many threa…
Joint Standard Errors of RegressionHello everyone, I am trying to model the line of the intersect between the equation Y = a + b1.X1 + …
How to create variables recording characteristics of the other members in the householdHello, I’m working with a time use database with information at the individual and household level.…
Panel data, time series: creating variable after specific entryHi all, I'm trying to create variable that is equal to the date at which the first plane is produce…
Restricting the survival analysis to first five years since diagnosisHi Everyone, Below is an example of data from the survival analysis. The total duration of follow…
Subscribe to:
Post Comments (Atom)
0 Response to Baseline hazard function for Piecewise constant model
Post a Comment