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.
How to know the impacts of other variables on the DID estimate?I have searched around but didn't have any luck. I am trying to estimate and then compare the DID es…
Replace a value of multiple observations for one variableDear all, I have a variable name "village", and wanted to replace the name of village in observation…
How to compare statistical difference between coefficients of two regressionsDear Stata Users, Please, help me with the following. How do I compare statistical difference betw…
Sorting issue when sort is expanded by a variableHello, I have an issue running the following command Code: sort id _mi_m survey expectation gift…
lowess with confidence intervalsDear Stata users, I am wondering is it possible to graph the lowess smoothing function with confide…
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