PlotScope
Statistics in real R

Kaplan–Meier curves with the log-rank test, run in R

One row per participant with the follow-up time, the event (1 = happened, 0 = censored) and a group. You get Kaplan–Meier curves with the numbers at risk, the log-rank test and the hazard ratio from a Cox model, with proportional hazards checked.

Kaplan-Meier curves for two groups with log-rank p and hazard ratio, made by PlotScope in R
Real output of the PlotScope R engine, made from sample data.

Your table

timeeventgroup
1201Control
3650Treatment
481Control

One row per subject: time, event (1 = happened, 0 = censored) and group or covariates.

How it is chosen

Kaplan-Meier curves with the log-rank test; with a group column, the hazard ratio comes from a Cox model and proportional hazards are checked. An actuarial life table is available for interval data.

You get

R packages: R · survival · ggplot2

Questions

How do I code censored participants?

Event = 0 for censored, 1 for the event. A 1/2 coding is recognised and converted.

Where does the hazard ratio come from?

From a Cox proportional hazards model fitted to the same data, with the proportional hazards assumption checked.

More from PlotScope