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.
Obtain same results with regress and rifhdregHi everyone, I am trying to make a RIF regression analysis using an inequality index that uses two…
Is there a way to use panel data rolling regressions with driscoll-Kraay standard errors?Hello to everyone in this forum, I wonder if there is a way to add Driscoll-Kraay standard errors t…
Counting every pair combination on a datasetDear Statalist, Suppose you have the following dataset: City_1 City_2 Flow Pair_ID AAA BBB 456…
xtlogit and excluding ineligible participantsHi Listers, I have collected data of people who want to join the gym at 4 regular intervals. At eac…
Coefplot: Displaying each level of a factor variable in one plotGreetings: I am trying to visualize the data for logistic regressions. My independent variable of i…
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