Survival Analysis

MIDAS provides two survival analysis methods:

  • Kaplan-Meier: Estimate survival curves and compare groups (log-rank test). Visually assess differences in survival between groups and test whether they differ
  • Cox Regression: Estimate the effect of covariates on hazard. Evaluate the simultaneous impact of multiple variables on survival time

See Survival Analysis Fundamentals for the mathematical background.

Data Requirements

Survival analysis requires two variables:

  • Time variable: Time to event (numeric)
  • Event variable: Indicates whether the event occurred. The following formats are supported:
    • Numeric: 1 = event, 0 = censored
    • Boolean: true = event, false = censored

See Survival Analysis Fundamentals for how censoring is handled.

Kaplan-Meier

The Kaplan-Meier method is a nonparametric estimator of the survival function (formulation).

Basic Usage

  1. Select Analysis > Kaplan-Meier... from the menu bar
  2. Select the Time Variable
  3. Select the Event Variable
  4. Optionally select a Group Variable for group comparison
  5. Click Run Analysis

Kaplan-Meier form configuration

Understanding Results

Group comparison results (survival curves, Summary Statistics, Number at Risk, log-rank test)

Survival Curve

Plots survival probability S(t)S(t) against time. Displayed as a step function that decreases at each event time. Censoring times are marked with a + symbol on the curve. A + mark on a flat segment indicates that subjects were lost to follow-up during that interval. A pointwise confidence band (95% by default) is shown. A pointwise band consists of individual intervals at each time point and does not guarantee simultaneous coverage of the entire curve, computed using the log transformation method (details).

Adjust the confidence level with the Confidence Level slider.

Summary Statistics

ColumnDescription
GroupGroup name (when Group Variable is specified)
nNumber of observations
EventsNumber of events
MedianMedian survival time, the time when S(t)=0.5S(t) = 0.5. Displayed as NR (Not Reached) if not reached within the observation period

Confidence interval for the median is not currently reported.

Number at Risk

Shows the risk set size (the number of subjects who have not yet experienced the event and have not been censored) at each time point.

Log-rank Test

Displayed when a Group Variable is specified. Tests the null hypothesis that all groups have equal hazard functions. The log-rank test has maximum power under the proportional hazards assumption. Power decreases when survival curves cross (details).

ItemDescription
Chi-squaredTest statistic
dfDegrees of freedom (= number of groups - 1)
p-valuep-value

Observed events, expected events under the null hypothesis, and their ratio (O/E) are also shown per group. A group with O/E > 1 experienced more events than expected under the null hypothesis.

Notes

  • Rows with missing values in the time or event variable are automatically excluded

Adding to Reports

Click Add to Report to add the survival curve to a report.

Cox Regression

The Cox proportional hazards model is a semiparametric model that estimates the effect of covariates on hazard (formulation and theory).

Basic Usage

  1. Select Analysis > Cox Regression... from the menu bar
  2. Select the Time Variable
  3. Select the Event Variable
  4. Select one or more Covariates (numeric only)
  5. Click Run Analysis

To use categorical variables as covariates, convert them with Dummy Coding first.

Cox regression form configuration

Understanding Results

Cox Proportional Hazards Regression

Cox Proportional Hazards Regression section

The upper coefficients table shows the following columns for each covariate.

ColumnDescription
VariableVariable name
CoefRegression coefficient β\beta
HRHazard ratio exp(β)\exp(\beta)
CIConfidence interval for the hazard ratio. The column header reflects the selected confidence level (e.g., "95% CI")
zWald statistic
p-valuep-value

A hazard ratio greater than 1 indicates that an increase in the covariate raises the hazard; less than 1 indicates it lowers the hazard. See Survival Analysis Fundamentals for detailed interpretation.

Below the table, three test statistics are reported.

MetricDescription
Likelihood Ratio TestNull hypothesis: all β=0\beta = 0. Generally most stable in finite samples
Wald TestNull hypothesis: all β=0\beta = 0. Based on the estimated covariance matrix
Score TestEvaluated at β=0\beta = 0. Can be computed even when convergence is problematic

The three tests are asymptotically equivalent and yield similar results in large samples. When they disagree in finite samples, prefer the likelihood ratio test. The Wald test is a local approximation based on the curvature of the log-likelihood at the MLE and can become inaccurate when coefficients are large or the likelihood surface is asymmetric. The Score test is evaluated at β=0\beta = 0 and loses approximation accuracy when the true values are far from zero. The likelihood ratio test compares log-likelihoods of the null and fitted models directly, without relying on local approximations (details).

Proportional Hazards Diagnostics

Proportional hazards diagnostics (Grambsch-Therneau test, Schoenfeld residual plots, Log-Log plot)

Below the coefficients table and model fit statistics, MIDAS displays diagnostics for the proportional hazards assumption. The Cox model assumes that covariate effects are constant over time — this is the proportional hazards assumption (details). When it breaks down, β\beta can only be interpreted as a weighted average over time.

Grambsch-Therneau Test

Tests the association between scaled Schoenfeld residuals and time (Grambsch & Therneau, 1994). Uses the KM time transformation g(t)=1S^(t)g(t) = 1 - \hat{S}(t^-).

ColumnDescription
VariableVariable name. GLOBAL tests all covariates simultaneously
rhoCorrelation between scaled Schoenfeld residuals and a Kaplan-Meier-based time transform. Values close to 0 are consistent with the assumption
Chi-SquaredTest statistic
dfDegrees of freedom. 1 per covariate; number of covariates for GLOBAL
p-valuep-value

When the p-value falls below the pre-specified significance level, the proportional hazards assumption is rejected for that covariate. This indicates that the covariate's effect changes over time. With multiple covariates, check the GLOBAL result first. If GLOBAL is not rejected, a small p-value for an individual covariate may be a chance finding.

Scaled Schoenfeld Residuals

For each covariate, plots scaled Schoenfeld residuals against time. The red curve is a LOESS smooth; the dashed gray line is the estimated coefficient β^\hat\beta. Under proportional hazards, residuals scatter randomly around β^\hat\beta and the LOESS line stays close to horizontal. An upward or downward trend in the LOESS line indicates that the covariate's effect varies over time. When visual assessment is uncertain, refer to the p-value from the Grambsch-Therneau test above.

Log-Log Survival Plot

Plots group-specific Kaplan-Meier estimates as log(log(S^(t)))\log(-\log(\hat{S}(t))) versus log(t)\log(t). Select the grouping covariate from the Grouping Variable dropdown. Continuous variables are split into two groups at the median for visual inspection; this split is a convenience and discards some information from the continuous variable. Under proportional hazards, the curves are approximately parallel. Curves that cross or change their separation over time suggest a violation.

When the proportional hazards assumption is rejected, approaches such as stratified Cox models or time-dependent covariate models can address the violation, but MIDAS does not currently support them. When a violation is detected, interpret results with care, considering the severity of the violation and the goals of the analysis.

Notes

  • When convergence fails, a warning is displayed in the results. The Score test can still be computed in this case, providing a basis for assessing model usefulness
  • Rows with missing values in the time, event, or any covariate variable are automatically excluded. Compare n (observations) in the results with the original row count to check how many rows were excluded

See also

References

  • Grambsch, P. M. and Therneau, T. M. (1994). Proportional hazards tests and diagnostics based on weighted residuals. Biometrika, 81(3), 515--526. https://www.jstor.org/stable/2337123