Hello there. I came across this really interesting post, however unfortunately this is based on R.
https://missingdatasolutions.rbind.i...0the%20predict.
I would like to clarify these questions:
After running a Cox model and I would like to predict the probability of a failed surgery occurring in 5 years and 10 years depending on the surgeon's number of cases
Question 1:
Do I need to set the mean values for all the covariates or should I use group centering process?
The reason I ask, as in the link above in the 'Mean centering process', it says the Cox regression generates mean values and but is this possible in categorical binary variables such as mALE VS Female - how can you generate a mean from here?
Generating mean values:
Or should I do a group centering mean process?
Question 2: Predicting 5 year survival Normally following a weibull parametric test a gamma is produced and can be saved with the code below to generate a linear prediction. A gamma value is not produced in cox, so do I just run the predict after my cox model? (happy with Model, PH hazard and Martingale residuals) With weibull:
With cox:
I also found this from a previous old post
https://www.stata.com/statalist/arch.../msg00649.html
The author recommends using this predict command:
After running your Cox model: predict double xbeta, xb predict double basesurv, basesurv //don't understand whats happening here But I'm not sure what the author refers to here in case of generating a 5 year survival probability
You can of course avoid the use of the scalar, but the above code makes it a little clearer what you're doing. Here's the abbreviated version: sum basesurv if _t<5 gen risk5y=1 - r(min)^exp(xbeta). <--- i don't understand why the author uses exp(xbeta) - x beta is from the linear predictor, but why exp xbeta?
https://missingdatasolutions.rbind.i...0the%20predict.
I would like to clarify these questions:
After running a Cox model and I would like to predict the probability of a failed surgery occurring in 5 years and 10 years depending on the surgeon's number of cases
Question 1:
Do I need to set the mean values for all the covariates or should I use group centering process?
The reason I ask, as in the link above in the 'Mean centering process', it says the Cox regression generates mean values and but is this possible in categorical binary variables such as mALE VS Female - how can you generate a mean from here?
Generating mean values:
Code:
* set covariates to mean values foreach v of varlist var1 var2 var3 var4 { quietly replace model`v' = scalar(mean`v') }
Code:
gen centered_var = var1 - r(mean)
Code:
scalar gamma = e(gamma) //5 year survival from model
Code:
* calculate the linear prediction and the standard error of the linear prediction predict xb, xb predict se, stdp
I also found this from a previous old post
https://www.stata.com/statalist/arch.../msg00649.html
The author recommends using this predict command:
After running your Cox model: predict double xbeta, xb predict double basesurv, basesurv //don't understand whats happening here But I'm not sure what the author refers to here in case of generating a 5 year survival probability
You can of course avoid the use of the scalar, but the above code makes it a little clearer what you're doing. Here's the abbreviated version: sum basesurv if _t<5 gen risk5y=1 - r(min)^exp(xbeta). <--- i don't understand why the author uses exp(xbeta) - x beta is from the linear predictor, but why exp xbeta?