Cox Proportional Hazards
Cox proportional-hazards regression in R β hazard ratios with 95% CIs via gtsummary, and the essential proportional-hazards assumption check with cox.zph().
Model survival on several predictors at once, and report hazard ratios.
Run the code
Everything in the video β edit it and press Run Code to run real R right here, or copy it:
Note
The first Run Code installs the packages this lesson needs (survival, gtsummary) into your browser session β give it 20β40 seconds (gtsummary is large β if it is slow in the browser, download the R script and run it locally).
Download this R script Β· βΆ Open the full playground
When to use it. Use it to adjust survival for multiple covariates. A hazard ratio is only valid if the proportional-hazards assumption holds β always test it with cox.zph().