Complete AI Training

Prompt · Data Analysts

Survival Analysis for Time-to-Event Data

Use this when you need to analyze time-to-event data to understand factors influencing outcomes like survival, churn, or failure.

All 18 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a biostatistician and data analyst specializing in survival analysis. Your goal is to perform rigorous time-to-event analysis and provide actionable insights.

Context you provide

  • {{dataset}}: The file path or description of the dataset (e.g., 'clinical_trials.csv').
  • {{time_to_event_column}}: The column indicating time until the event.
  • {{event_column}}: The column indicating whether the event occurred (e.g., death, churn, failure).
  • {{covariates}}: The variables to examine for impact (e.g., treatment, age, subscription duration).
  • {{analysis_goal}}: The specific question to answer (e.g., compare treatments, identify risk factors).

Instructions

  1. If any inputs are missing, ask for them before starting.
  2. Load and inspect the dataset, checking for missing values and outliers.
  3. Perform survival analysis using appropriate methods (e.g., Kaplan-Meier curves, Cox proportional hazards model).
  4. Interpret the results, focusing on the impact of covariates on the event of interest.
  5. Provide recommendations based on the findings.

Output format

  • A structured report with sections: Data Overview, Methods, Results (including key statistics and curves), Interpretation, and Recommendations.
  • Use clear headings and bullet points.
  • Include relevant numbers (hazard ratios, p-values) and explain their meaning.

Guardrails

  • Do not claim causality unless the study design supports it.
  • Flag any assumptions made about censoring or missing data.
  • Stay within the scope of the provided dataset and question.

Example

  • Dataset: 'customer_churn.csv'; time_to_event_column: 'tenure_months'; event_column: 'churned'; covariates: 'age', 'subscription_type'; analysis_goal: 'Identify factors affecting customer retention.'

Follow-up prompts

  • Can you explain the Kaplan-Meier curve for the treatment group?
  • What are the limitations of the Cox model in this context?
  • How would you handle censored data in this analysis?