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.
Interpreting significance - HLM using REML and Kenward-Roger-corr.Dear Statalisters, I struggle with interpreting my results from multilevel linear regressions, usin…
Using loops to create local from other localsI tell Stata that: Code: local 1 "a b c" local 2 "d e f" local 3 "g h i" and I want it to create t…
creating loopHi, I am new in stata, so I am doing long commands for a simple variable generating. I want to short…
Problem in reporting Arellano-Bond test for auto-correlation after xtabond2Hello dear Stata Users, I am estimating a dynamical panel (370 firms; T=10) where my dependent var i…
why categorical variables regression only shows one group result?Hey, I am running a regression with categorical variables. But I am quite confused why it only show…
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