Hi, everybody,
I have a dataset like this,
* Example generated by -dataex.
clear
input int id int time byte injury byte safescore
1 1 1 9
2 1 1 9
3 1 0 6
3 2 0 6
3 3 1 6
4 1 0 6
4 2 0 6
4 3 0 6
5 1 0 6
5 2 1 7
6 1 0 6
6 2 0 6
7 1 0 6
7 2 0 8
8 1 0 6
8 2 0 6
8 3 1 7
9 1 0 6
9 2 1 8
10 1 0 6
10 2 1 7
end
I fitted a simple discrete-time survival model with logit function in Stata.
logit injury safescore,nocons
Now, I want to graph the fitted hazard curve at mean of safescore, mean+SD, and mean-SD in Stata.
For ease of interpretation, I centered the safescore at the mean and created the resulting variable c_safescore.
egen safescore_mean=mean(safescore)
egen safescore_sd=sd(safescore)
gen c_safescore=safescore-safescore_mean
gen c_safescore_upper=c_safescore+1*safescore_sd
gen c_safescore_lower=c_safescore-1*safescore_sd
Can someone help me to do this in Stata?
My own solution is below,
predict c_safescore_m
line c_safescore_m time, sort
||
line c_safescore_lower time, sort
||
line c_safescore_upper time, sort
It seems that something is incorrect.
Related Posts with Plot the estimated hazard curve at mean-1*SD mean, and mean+1*SD after fitting survival analysis using Stata.
New version of kmest on SSC (AGAIN)Thanks once again to Kit Baum, a new version of the kmest package (superseding yesterday's version) …
Calculating date from day of year and yearHi there, I have a day-of-year variable (1 - 366), and year variable (4- digit, i.e. - 2012, etc) a…
PSM with psmatch2 and xtregHello everyone, I'm trying to do a difference in difference regression on matched data. However, I …
Problem with Counting observations across firm identifierDear Stata users, Version 16.1 I have 4 variables - firm_id, type_product, type_airframe, and Appli…
Censored RegressionCould anyone please specify the command for censored regression models in STATA. …
Subscribe to:
Post Comments (Atom)
0 Response to Plot the estimated hazard curve at mean-1*SD mean, and mean+1*SD after fitting survival analysis using Stata.
Post a Comment