[{"data":1,"prerenderedAt":852},["ShallowReactive",2],{"content-query-vMQVkYn5vL":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"heading":10,"prompt":11,"tags":15,"files":19,"nav":19,"presets":20,"gallery":38,"body":40,"_type":845,"_id":846,"_source":847,"_file":848,"_stem":849,"_extension":850,"sitemap":851},"/tools/survival-curve","tools",false,"","Kaplan-Meier Survival Curve Generator","Create Kaplan-Meier survival curves online from Excel or CSV data. Analyze time-to-event outcomes, censoring, and log-rank tests with AI.","Survival Curve Generator",{"prefix":12,"label":13,"placeholder":14},"Create a survival curve","Describe the survival analysis you want to run","e.g. Kaplan-Meier survival curve by treatment group, log-rank test, median survival time",[16,17,18],"charts","statistics","science",true,[21,27,33],{"label":22,"prompt":23,"dataset_url":24,"dataset_title":25,"dataset_citation":26},"Cancer survival by stage","Kaplan-Meier survival curves by cancer stage (I, II, III, IV); time column is 'months_survived', event column is 'died' (1=death, 0=censored); add 95% confidence bands; log-rank test; annotate median survival for each stage; number at risk table below","https://data.cdc.gov/api/views/w9j2-ggv5/rows.csv?accessType=DOWNLOAD","United States Cancer Statistics","CDC",{"label":28,"prompt":29,"dataset_url":30,"dataset_title":31,"dataset_citation":32},"Patient survival by treatment","Kaplan-Meier survival curves comparing treatment arm vs control; compute median survival time and 95% CI for each group; log-rank test p-value; add censoring tick marks; 1-year and 2-year survival probability annotations","https://ourworldindata.org/grapher/cancer-death-rates-by-type.csv","Cancer death rates by type","Our World in Data",{"label":34,"prompt":35,"dataset_url":36,"dataset_title":37,"dataset_citation":32},"Customer churn survival analysis","Kaplan-Meier curve of customer retention: time column is 'days_active', event column is 'churned' (1=churned, 0=still active); compare by subscription tier; annotate median retention time; 30/60/90-day survival probabilities","https://ourworldindata.org/grapher/life-expectancy.csv","Life expectancy",[39],"/img/tools/survival-curve.png",{"type":41,"children":42,"toc":834},"root",[43,52,87,97,144,150,236,242,371,382,388,538,544,651,657,711,717,746,752,762,772,800,817],{"type":44,"tag":45,"props":46,"children":48},"element","h2",{"id":47},"what-is-a-survival-curve",[49],{"type":50,"value":51},"text","What Is a Survival Curve?",{"type":44,"tag":53,"props":54,"children":55},"p",{},[56,58,64,66,71,73,78,80,85],{"type":50,"value":57},"A ",{"type":44,"tag":59,"props":60,"children":61},"strong",{},[62],{"type":50,"value":63},"survival curve",{"type":50,"value":65}," (Kaplan-Meier curve) is a step-function that estimates the ",{"type":44,"tag":59,"props":67,"children":68},{},[69],{"type":50,"value":70},"probability of surviving beyond each point in time",{"type":50,"value":72}," for a group of individuals. Starting at 1.0 (100% survival) at time zero, the curve drops each time an ",{"type":44,"tag":59,"props":74,"children":75},{},[76],{"type":50,"value":77},"event",{"type":50,"value":79}," occurs — where an \"event\" means whatever outcome you're tracking: death, disease recurrence, equipment failure, customer churn, or employee turnover. The curve reaches its final step at the time of the last observed event and then either ends or continues flat if the last observation was ",{"type":44,"tag":59,"props":81,"children":82},{},[83],{"type":50,"value":84},"censored",{"type":50,"value":86},".",{"type":44,"tag":53,"props":88,"children":89},{},[90,95],{"type":44,"tag":59,"props":91,"children":92},{},[93],{"type":50,"value":94},"Censoring",{"type":50,"value":96}," is the feature that makes survival analysis unique among statistical methods. A censored observation is one where the event hasn't happened yet — the patient was still alive at the last follow-up, the machine was still running when the study ended, or the customer was still subscribed when the data was pulled. Rather than discarding these observations (which would bias the estimate downward) or pretending the event happened at the last follow-up (which would bias it upward), the Kaplan-Meier estimator correctly incorporates censored observations: they contribute to the \"at risk\" count until their last observation time and then leave the analysis without triggering a step down. This is why survival analysis is the correct method for any time-to-event data with incomplete follow-up.",{"type":44,"tag":53,"props":98,"children":99},{},[100,102,107,109,114,116,121,123,128,130,135,137,142],{"type":50,"value":101},"Survival curves are the standard visualization in ",{"type":44,"tag":59,"props":103,"children":104},{},[105],{"type":50,"value":106},"clinical trials",{"type":50,"value":108}," (comparing survival between a treatment arm and a control arm), ",{"type":44,"tag":59,"props":110,"children":111},{},[112],{"type":50,"value":113},"oncology",{"type":50,"value":115}," (survival by cancer stage or molecular subtype), ",{"type":44,"tag":59,"props":117,"children":118},{},[119],{"type":50,"value":120},"reliability engineering",{"type":50,"value":122}," (time to equipment failure by component), and ",{"type":44,"tag":59,"props":124,"children":125},{},[126],{"type":50,"value":127},"business analytics",{"type":50,"value":129}," (customer churn, time to conversion, employee retention). When multiple groups are compared, the ",{"type":44,"tag":59,"props":131,"children":132},{},[133],{"type":50,"value":134},"log-rank test",{"type":50,"value":136}," provides a p-value for whether the survival curves are statistically different — and the ",{"type":44,"tag":59,"props":138,"children":139},{},[140],{"type":50,"value":141},"hazard ratio",{"type":50,"value":143}," quantifies how much faster one group reaches the event.",{"type":44,"tag":45,"props":145,"children":147},{"id":146},"how-it-works",[148],{"type":50,"value":149},"How It Works",{"type":44,"tag":151,"props":152,"children":153},"ol",{},[154,185,201],{"type":44,"tag":155,"props":156,"children":157},"li",{},[158,163,165,170,172,176,178,183],{"type":44,"tag":59,"props":159,"children":160},{},[161],{"type":50,"value":162},"Upload your data",{"type":50,"value":164}," — provide a CSV or Excel file with at least two columns: a ",{"type":44,"tag":59,"props":166,"children":167},{},[168],{"type":50,"value":169},"time",{"type":50,"value":171}," column (numeric, duration until event or censoring) and an ",{"type":44,"tag":59,"props":173,"children":174},{},[175],{"type":50,"value":77},{"type":50,"value":177}," column (binary: 1 = event occurred, 0 = censored). An optional ",{"type":44,"tag":59,"props":179,"children":180},{},[181],{"type":50,"value":182},"group",{"type":50,"value":184}," column produces separate curves per group.",{"type":44,"tag":155,"props":186,"children":187},{},[188,193,195],{"type":44,"tag":59,"props":189,"children":190},{},[191],{"type":50,"value":192},"Describe the analysis",{"type":50,"value":194}," — e.g. ",{"type":44,"tag":196,"props":197,"children":198},"em",{},[199],{"type":50,"value":200},"\"Kaplan-Meier curves by treatment group, 95% confidence bands, log-rank test, annotate median survival\"",{"type":44,"tag":155,"props":202,"children":203},{},[204,209,211,218,220,226,228,234],{"type":44,"tag":59,"props":205,"children":206},{},[207],{"type":50,"value":208},"Get the visualization",{"type":50,"value":210}," — the AI writes Python code using ",{"type":44,"tag":212,"props":213,"children":215},"a",{"href":214},"https://lifelines.readthedocs.io/",[216],{"type":50,"value":217},"lifelines",{"type":50,"value":219}," or manual Kaplan-Meier computation with ",{"type":44,"tag":212,"props":221,"children":223},{"href":222},"https://numpy.org/",[224],{"type":50,"value":225},"numpy",{"type":50,"value":227}," and ",{"type":44,"tag":212,"props":229,"children":231},{"href":230},"https://plotly.com/python/",[232],{"type":50,"value":233},"Plotly",{"type":50,"value":235}," to render the survival curves with all annotations",{"type":44,"tag":45,"props":237,"children":239},{"id":238},"required-data-format",[240],{"type":50,"value":241},"Required Data Format",{"type":44,"tag":243,"props":244,"children":245},"table",{},[246,270],{"type":44,"tag":247,"props":248,"children":249},"thead",{},[250],{"type":44,"tag":251,"props":252,"children":253},"tr",{},[254,260,265],{"type":44,"tag":255,"props":256,"children":257},"th",{},[258],{"type":50,"value":259},"Column",{"type":44,"tag":255,"props":261,"children":262},{},[263],{"type":50,"value":264},"Description",{"type":44,"tag":255,"props":266,"children":267},{},[268],{"type":50,"value":269},"Example",{"type":44,"tag":271,"props":272,"children":273},"tbody",{},[274,303,338],{"type":44,"tag":251,"props":275,"children":276},{},[277,287,292],{"type":44,"tag":278,"props":279,"children":280},"td",{},[281],{"type":44,"tag":282,"props":283,"children":285},"code",{"className":284},[],[286],{"type":50,"value":169},{"type":44,"tag":278,"props":288,"children":289},{},[290],{"type":50,"value":291},"Duration from start to event or censoring",{"type":44,"tag":278,"props":293,"children":294},{},[295,301],{"type":44,"tag":282,"props":296,"children":298},{"className":297},[],[299],{"type":50,"value":300},"24.5",{"type":50,"value":302}," (months)",{"type":44,"tag":251,"props":304,"children":305},{},[306,314,319],{"type":44,"tag":278,"props":307,"children":308},{},[309],{"type":44,"tag":282,"props":310,"children":312},{"className":311},[],[313],{"type":50,"value":77},{"type":44,"tag":278,"props":315,"children":316},{},[317],{"type":50,"value":318},"1 if event occurred, 0 if censored",{"type":44,"tag":278,"props":320,"children":321},{},[322,328,330,336],{"type":44,"tag":282,"props":323,"children":325},{"className":324},[],[326],{"type":50,"value":327},"1",{"type":50,"value":329}," (died), ",{"type":44,"tag":282,"props":331,"children":333},{"className":332},[],[334],{"type":50,"value":335},"0",{"type":50,"value":337}," (alive at last contact)",{"type":44,"tag":251,"props":339,"children":340},{},[341,349,354],{"type":44,"tag":278,"props":342,"children":343},{},[344],{"type":44,"tag":282,"props":345,"children":347},{"className":346},[],[348],{"type":50,"value":182},{"type":44,"tag":278,"props":350,"children":351},{},[352],{"type":50,"value":353},"Optional: group/arm label for comparison",{"type":44,"tag":278,"props":355,"children":356},{},[357,363,365],{"type":44,"tag":282,"props":358,"children":360},{"className":359},[],[361],{"type":50,"value":362},"Treatment",{"type":50,"value":364},", ",{"type":44,"tag":282,"props":366,"children":368},{"className":367},[],[369],{"type":50,"value":370},"Control",{"type":44,"tag":53,"props":372,"children":373},{},[374,376,381],{"type":50,"value":375},"Any column names work — describe them in your prompt: ",{"type":44,"tag":196,"props":377,"children":378},{},[379],{"type":50,"value":380},"\"time column is 'days_to_event', event column is 'outcome'\"",{"type":50,"value":86},{"type":44,"tag":45,"props":383,"children":385},{"id":384},"interpreting-the-results",[386],{"type":50,"value":387},"Interpreting the Results",{"type":44,"tag":243,"props":389,"children":390},{},[391,407],{"type":44,"tag":247,"props":392,"children":393},{},[394],{"type":44,"tag":251,"props":395,"children":396},{},[397,402],{"type":44,"tag":255,"props":398,"children":399},{},[400],{"type":50,"value":401},"Visual element",{"type":44,"tag":255,"props":403,"children":404},{},[405],{"type":50,"value":406},"What it means",{"type":44,"tag":271,"props":408,"children":409},{},[410,426,442,458,474,490,506,522],{"type":44,"tag":251,"props":411,"children":412},{},[413,421],{"type":44,"tag":278,"props":414,"children":415},{},[416],{"type":44,"tag":59,"props":417,"children":418},{},[419],{"type":50,"value":420},"Step down",{"type":44,"tag":278,"props":422,"children":423},{},[424],{"type":50,"value":425},"An event (death, failure, churn) occurred at this time point",{"type":44,"tag":251,"props":427,"children":428},{},[429,437],{"type":44,"tag":278,"props":430,"children":431},{},[432],{"type":44,"tag":59,"props":433,"children":434},{},[435],{"type":50,"value":436},"Flat section",{"type":44,"tag":278,"props":438,"children":439},{},[440],{"type":50,"value":441},"No events — everyone at risk survived this interval",{"type":44,"tag":251,"props":443,"children":444},{},[445,453],{"type":44,"tag":278,"props":446,"children":447},{},[448],{"type":44,"tag":59,"props":449,"children":450},{},[451],{"type":50,"value":452},"Tick mark on curve",{"type":44,"tag":278,"props":454,"children":455},{},[456],{"type":50,"value":457},"Censored observation — subject left the study without the event",{"type":44,"tag":251,"props":459,"children":460},{},[461,469],{"type":44,"tag":278,"props":462,"children":463},{},[464],{"type":44,"tag":59,"props":465,"children":466},{},[467],{"type":50,"value":468},"Shaded band",{"type":44,"tag":278,"props":470,"children":471},{},[472],{"type":50,"value":473},"95% confidence interval (Greenwood formula) — wider = fewer at risk",{"type":44,"tag":251,"props":475,"children":476},{},[477,485],{"type":44,"tag":278,"props":478,"children":479},{},[480],{"type":44,"tag":59,"props":481,"children":482},{},[483],{"type":50,"value":484},"Median survival",{"type":44,"tag":278,"props":486,"children":487},{},[488],{"type":50,"value":489},"Time where the curve crosses 50% — half the group has had the event by then",{"type":44,"tag":251,"props":491,"children":492},{},[493,501],{"type":44,"tag":278,"props":494,"children":495},{},[496],{"type":44,"tag":59,"props":497,"children":498},{},[499],{"type":50,"value":500},"Gap between curves",{"type":44,"tag":278,"props":502,"children":503},{},[504],{"type":50,"value":505},"Difference in survival — the higher curve has better outcomes",{"type":44,"tag":251,"props":507,"children":508},{},[509,517],{"type":44,"tag":278,"props":510,"children":511},{},[512],{"type":44,"tag":59,"props":513,"children":514},{},[515],{"type":50,"value":516},"Crossing curves",{"type":44,"tag":278,"props":518,"children":519},{},[520],{"type":50,"value":521},"Survival advantage reverses over time — treatment works early but not late",{"type":44,"tag":251,"props":523,"children":524},{},[525,533],{"type":44,"tag":278,"props":526,"children":527},{},[528],{"type":44,"tag":59,"props":529,"children":530},{},[531],{"type":50,"value":532},"Log-rank p-value",{"type":44,"tag":278,"props":534,"children":535},{},[536],{"type":50,"value":537},"Probability the observed difference between curves is due to chance",{"type":44,"tag":45,"props":539,"children":541},{"id":540},"example-prompts",[542],{"type":50,"value":543},"Example Prompts",{"type":44,"tag":243,"props":545,"children":546},{},[547,563],{"type":44,"tag":247,"props":548,"children":549},{},[550],{"type":44,"tag":251,"props":551,"children":552},{},[553,558],{"type":44,"tag":255,"props":554,"children":555},{},[556],{"type":50,"value":557},"Scenario",{"type":44,"tag":255,"props":559,"children":560},{},[561],{"type":50,"value":562},"What to type",{"type":44,"tag":271,"props":564,"children":565},{},[566,583,600,617,634],{"type":44,"tag":251,"props":567,"children":568},{},[569,574],{"type":44,"tag":278,"props":570,"children":571},{},[572],{"type":50,"value":573},"Clinical trial",{"type":44,"tag":278,"props":575,"children":576},{},[577],{"type":44,"tag":282,"props":578,"children":580},{"className":579},[],[581],{"type":50,"value":582},"Kaplan-Meier by treatment group, 95% CI, log-rank test, median survival annotations",{"type":44,"tag":251,"props":584,"children":585},{},[586,591],{"type":44,"tag":278,"props":587,"children":588},{},[589],{"type":50,"value":590},"Cancer staging",{"type":44,"tag":278,"props":592,"children":593},{},[594],{"type":44,"tag":282,"props":595,"children":597},{"className":596},[],[598],{"type":50,"value":599},"survival curves for stage I–IV, number at risk table, 1- and 5-year survival probabilities",{"type":44,"tag":251,"props":601,"children":602},{},[603,608],{"type":44,"tag":278,"props":604,"children":605},{},[606],{"type":50,"value":607},"Customer churn",{"type":44,"tag":278,"props":609,"children":610},{},[611],{"type":44,"tag":282,"props":612,"children":614},{"className":613},[],[615],{"type":50,"value":616},"survival curve of customer retention by subscription plan, annotate 30/90/180-day retention",{"type":44,"tag":251,"props":618,"children":619},{},[620,625],{"type":44,"tag":278,"props":621,"children":622},{},[623],{"type":50,"value":624},"Equipment reliability",{"type":44,"tag":278,"props":626,"children":627},{},[628],{"type":44,"tag":282,"props":629,"children":631},{"className":630},[],[632],{"type":50,"value":633},"survival curve of time to failure by component type, hazard ratio between groups",{"type":44,"tag":251,"props":635,"children":636},{},[637,642],{"type":44,"tag":278,"props":638,"children":639},{},[640],{"type":50,"value":641},"Competing risks",{"type":44,"tag":278,"props":643,"children":644},{},[645],{"type":44,"tag":282,"props":646,"children":648},{"className":647},[],[649],{"type":50,"value":650},"cumulative incidence curves for death vs relapse as competing events",{"type":44,"tag":45,"props":652,"children":654},{"id":653},"assumptions-to-check",[655],{"type":50,"value":656},"Assumptions to Check",{"type":44,"tag":658,"props":659,"children":660},"ul",{},[661,671,681,691,701],{"type":44,"tag":155,"props":662,"children":663},{},[664,669],{"type":44,"tag":59,"props":665,"children":666},{},[667],{"type":50,"value":668},"Independent censoring",{"type":50,"value":670}," — the reason a subject is censored must be unrelated to their risk of the event; if sicker patients drop out more often, the estimate is biased",{"type":44,"tag":155,"props":672,"children":673},{},[674,679],{"type":44,"tag":59,"props":675,"children":676},{},[677],{"type":50,"value":678},"Consistent event definition",{"type":50,"value":680}," — the event must mean the same thing across all groups and time periods",{"type":44,"tag":155,"props":682,"children":683},{},[684,689],{"type":44,"tag":59,"props":685,"children":686},{},[687],{"type":50,"value":688},"Proportional hazards (for log-rank test)",{"type":50,"value":690}," — the log-rank test has the most power when the survival curves are proportional (one is always above the other); if curves cross, a weighted log-rank test may be more appropriate",{"type":44,"tag":155,"props":692,"children":693},{},[694,699],{"type":44,"tag":59,"props":695,"children":696},{},[697],{"type":50,"value":698},"No left truncation",{"type":50,"value":700}," — subjects must enter the study at time 0; if some subjects are only observed after a delay (e.g. patients who survived long enough to enroll), truncation correction is needed",{"type":44,"tag":155,"props":702,"children":703},{},[704,709],{"type":44,"tag":59,"props":705,"children":706},{},[707],{"type":50,"value":708},"Sufficient follow-up",{"type":50,"value":710}," — if most observations are censored before the median, the curve may not reach 50% and median survival cannot be estimated",{"type":44,"tag":45,"props":712,"children":714},{"id":713},"related-tools",[715],{"type":50,"value":716},"Related Tools",{"type":44,"tag":53,"props":718,"children":719},{},[720,722,728,730,736,738,744],{"type":50,"value":721},"Use the ",{"type":44,"tag":212,"props":723,"children":725},{"href":724},"/tools/empirical-cdf",[726],{"type":50,"value":727},"Empirical CDF Plot Generator",{"type":50,"value":729}," when you have complete follow-up with no censoring — ECDF is simpler and does not require the survival analysis framework. Use the ",{"type":44,"tag":212,"props":731,"children":733},{"href":732},"/tools/density-plot",[734],{"type":50,"value":735},"Density Plot Generator",{"type":50,"value":737}," to visualize the distribution of event times when censoring is absent. Use the ",{"type":44,"tag":212,"props":739,"children":741},{"href":740},"/tools/logistic-regression",[742],{"type":50,"value":743},"Logistic Regression tool",{"type":50,"value":745}," to predict binary outcomes (event/no event) without modeling time.",{"type":44,"tag":45,"props":747,"children":749},{"id":748},"frequently-asked-questions",[750],{"type":50,"value":751},"Frequently Asked Questions",{"type":44,"tag":53,"props":753,"children":754},{},[755,760],{"type":44,"tag":59,"props":756,"children":757},{},[758],{"type":50,"value":759},"What is censoring and why does it matter?",{"type":50,"value":761},"\nCensoring means the event hasn't been observed yet — the patient is still alive at the study's end date, the machine is still running, or the customer is still subscribed. If you simply exclude censored observations, you bias the survival estimate downward (the sample looks sicker than it is). If you treat them as events, you bias it upward. The Kaplan-Meier estimator correctly handles censored observations by including them in the \"at risk\" count until their last known time and then removing them — neither counting them as events nor ignoring them.",{"type":44,"tag":53,"props":763,"children":764},{},[765,770],{"type":44,"tag":59,"props":766,"children":767},{},[768],{"type":50,"value":769},"My data doesn't have a group column — can I still use this tool?",{"type":50,"value":771},"\nYes — a single-group KM curve estimates the overall survival of your entire dataset without comparison. It will show the survival function with confidence intervals and report the median survival time. You can add a group column later if you want to compare subgroups.",{"type":44,"tag":53,"props":773,"children":774},{},[775,780,782,786,788,792,794,799],{"type":44,"tag":59,"props":776,"children":777},{},[778],{"type":50,"value":779},"What's the difference between the log-rank test and the hazard ratio?",{"type":50,"value":781},"\nThe ",{"type":44,"tag":59,"props":783,"children":784},{},[785],{"type":50,"value":134},{"type":50,"value":787}," produces a p-value answering \"are these survival curves statistically different?\" It doesn't quantify how different. The ",{"type":44,"tag":59,"props":789,"children":790},{},[791],{"type":50,"value":141},{"type":50,"value":793}," answers \"how much faster does Group A experience the event compared to Group B?\" A hazard ratio of 2.0 means Group A's event rate is double that of Group B at every point in time. Ask for both: ",{"type":44,"tag":196,"props":795,"children":796},{},[797],{"type":50,"value":798},"\"log-rank test and hazard ratio with 95% CI\"",{"type":50,"value":86},{"type":44,"tag":53,"props":801,"children":802},{},[803,808,810,815],{"type":44,"tag":59,"props":804,"children":805},{},[806],{"type":50,"value":807},"Can I estimate survival at a specific time point (e.g. 1-year survival)?",{"type":50,"value":809},"\nYes — ask to ",{"type":44,"tag":196,"props":811,"children":812},{},[813],{"type":50,"value":814},"\"annotate 1-year, 2-year, and 5-year survival probabilities for each group\"",{"type":50,"value":816},". The AI reads the KM curve at the specified time points and overlays the survival probability with confidence intervals.",{"type":44,"tag":53,"props":818,"children":819},{},[820,825,827,832],{"type":44,"tag":59,"props":821,"children":822},{},[823],{"type":50,"value":824},"What's a \"number at risk\" table and should I include one?",{"type":50,"value":826},"\nA number-at-risk table shows, below the x-axis, how many subjects remain in each group at each time point. It helps readers assess the reliability of the curve — estimates become less reliable as the at-risk count drops below ~10. Ask for ",{"type":44,"tag":196,"props":828,"children":829},{},[830],{"type":50,"value":831},"\"add a number at risk table below the plot\"",{"type":50,"value":833}," to include it, which is standard in clinical publications.",{"title":7,"searchDepth":835,"depth":835,"links":836},2,[837,838,839,840,841,842,843,844],{"id":47,"depth":835,"text":51},{"id":146,"depth":835,"text":149},{"id":238,"depth":835,"text":241},{"id":384,"depth":835,"text":387},{"id":540,"depth":835,"text":543},{"id":653,"depth":835,"text":656},{"id":713,"depth":835,"text":716},{"id":748,"depth":835,"text":751},"markdown","content:tools:034.survival-curve.md","content","tools/034.survival-curve.md","tools/034.survival-curve","md",{"loc":4},1775502468196]