The Cox Regression Tab
The Cox Regression tab fits the Cox proportional hazards model, a semiparametric model that estimates the effect of covariates on hazard (formulation and theory). See Survival Analysis Fundamentals for the mathematical background.
To compare groups defined by a single categorical variable, use The Kaplan-Meier Tab.
Data Requirements
Cox regression requires a time variable, an event variable, and one or more covariates:
- Time variable: Time to event (numeric)
- Event variable: Indicates whether the event occurred. The following formats are supported:
- int64: 1 = event, 0 = censored
- Boolean: true = event, false = censored
- Covariates: Numeric columns with interval or ratio scale
float64 columns cannot be selected as the event variable. If a column stores 0/1 values as decimals, convert it to int64 with The Convert Column Types Tab.
MIDAS accepts only 0 and 1 (false and true for boolean columns) as event variable values. If your data uses another coding scheme, such as 1 = censored and 2 = event, convert it to 0/1 with the SQL Query Editor tab.
MIDAS accepts values of 0 or more for the time variable. A time of 0 represents an event or a censoring at the start of observation, and both Kaplan-Meier estimation and Cox regression estimation can be computed on data that include time 0. A negative value points to a time before observation started, so MIDAS treats it as an error in the coding, such as dates subtracted in the wrong order or a missing-value code.
MIDAS cannot tell from the data whether a row with time 0 was in the risk set at the start of observation. In data that record an event that occurred before observation started as time 0, subjects that should not be in the risk set are counted as events at time 0, and the drop in survival probability at time 0 is estimated larger than it is. When many rows have time 0, check how the time origin is defined.
Columns whose scale is set to nominal or ordinal, as well as date/datetime columns, are grayed out in the covariate list and cannot be selected. To use categorical variables with three or more levels as covariates, convert them with Dummy Coding first. Columns that store binary values as booleans are inferred as nominal scale by default and cannot be selected; changing the scale to interval in the Data Table makes them selectable.
See Survival Analysis Fundamentals for how censoring is handled. MIDAS only supports right censoring. Left censoring, interval censoring, and competing risks are not supported.
Basic Usage
- Select Analysis > Survival Analysis > Cox Regression... from the menu bar
- Select the Time Variable
- Select the Event Variable
- Select one or more Covariates
- Click Run Analysis

Changing the variable selection or the covariates after a run makes the displayed results no longer belong to the current settings. MIDAS removes those results from the view and shows a message asking you to run the analysis again. Restoring the previous settings brings the results back. Changing Dataset also resets the variable selection, so the results are discarded instead. Changing Confidence Level keeps the results.
Understanding Results
Cox Proportional Hazards Regression

The upper coefficients table shows the following columns for each covariate.
| Column | Description |
|---|---|
| Variable | Variable name |
| Coef | Regression coefficient |
| SE | Standard error |
| HR | Hazard ratio |
| HR Lower nn%, HR Upper nn% | Lower and upper limits of the confidence interval for the hazard ratio at the selected confidence level, obtained from the Wald interval for through |
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, model fit metrics are reported.
| Metric | Description |
|---|---|
| Concordance Index | Harrell's C statistic. The proportion of comparable pairs where the risk score ordering agrees with the event ordering, with pairs of equal risk scores counted as 0.5. 0.5 means no discrimination, 1.0 means perfect discrimination. The standard error in parentheses is based on the influence function |
| AIC | Akaike Information Criterion (), where is the partial log-likelihood and is the number of coefficients. Used for model comparison |
| Log Partial Likelihood | Partial log-likelihood , the basis for AIC |
| Convergence | Whether the iterative computation converged (Yes / No) and the number of iterations started |
When the iterative computation stops before meeting the convergence criterion, MIDAS does not display the values that assume the maximum partial likelihood estimate. The coefficients table has two columns, Variable and Coef at Last Iteration, and the Coef at Last Iteration column shows the coefficients at the point where the iteration stopped. These values are not estimates. The model fit metrics are limited to Log Partial Likelihood at Last Iteration, Observations / Events, and Convergence, and the adjusted survival curve, the baseline cumulative hazard, and the proportional hazards diagnostics are not displayed. The Notes section explains why the iteration stops and what to check.
Adjusted Survival Curve

The adjusted survival curve plots predicted survival probability for a specific set of covariate values . It is computed from the baseline cumulative hazard and the estimated coefficients (formulation).
Each covariate has an input field, defaulting to the sample mean. Changing a value updates the curve immediately, so you can compare predicted survival across different covariate profiles. Reset to Means restores the defaults.
The shaded band around the curve is a pointwise confidence band for at the confidence level selected in Confidence Level, the same level as the coefficients table. A pointwise band consists of individual intervals at each time point and does not guarantee simultaneous coverage of the entire curve. The variance behind each interval combines two sources of uncertainty, the baseline hazard increments and the estimated coefficients, so the band widens toward the end of follow-up where the risk set is small, and widens further as the covariate values move away from the observed data (formulation).
The default profile of sample means is a computational reference point, not a description of the cohort. For a binary or categorical covariate, the sample mean (for example, 0.4 for a 0/1 covariate) does not correspond to any observed individual. The curve at the mean covariate values also differs from the average of the individual survival curves. To describe a specific group, enter the covariate values that define that group.
Baseline Cumulative Hazard
Below the adjusted survival curve, the baseline cumulative hazard table lists the following values at each event time point.
| Column | Description |
|---|---|
| Time | Event time |
| At Risk | Number of subjects in the risk set |
| Events | Number of events at this time |
| H0(t) | Cumulative baseline hazard |
| H0 Lower nn%, H0 Upper nn% | Lower and upper limits of the pointwise confidence interval for at the selected confidence level |
| S0(t) | Baseline survival function |
| S0 Lower nn%, S0 Upper nn% | Lower and upper limits of the pointwise confidence interval for , obtained from the interval for through |
The confidence intervals use the same level as the coefficients table and are the intervals of the adjusted survival curve at the all-covariates-zero profile (formulation). They are individual intervals at each time point, not a simultaneous band. A time point where the interval cannot be computed shows "-".
The baseline corresponds to all covariates set to zero. When zero is not a realistic value given the variable scales, use the adjusted survival curve with realistic covariate values (such as the sample mean) to inspect .
Proportional Hazards Diagnostics

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, can only be interpreted as a weighted average over time.
Proportional Hazards Diagnostics
Displays the correlation between scaled Schoenfeld residuals and time for each covariate (Grambsch & Therneau, 1994). Uses the KM time transformation .
| Column | Description |
|---|---|
| Variable | Variable name |
| rho | Pearson correlation between scaled Schoenfeld residuals and a Kaplan-Meier-based time transform. Values close to 0 are consistent with the assumption |
Covariates with a large absolute rho may have effects that change over time. Since rho alone does not reveal the pattern or severity of the departure, inspect the Schoenfeld residual plots below.
MIDAS cannot always compute rho. The denominator of the Pearson correlation is zero when either the scaled Schoenfeld residuals or the time transform is constant. This happens when fewer than two events are observed, and when all events occur at the same time. MIDAS shows rho as "-" in these cases.
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 . Under proportional hazards, residuals scatter randomly around 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.
Log-Log Survival Plot
Plots group-specific Kaplan-Meier estimates as versus . Select the grouping covariate from the Grouping Variable dropdown. When the selected covariate has five or fewer distinct values, each value forms its own group, and the legend lists the groups in ascending order of value. With six or more, observations are split into two groups at the median. Values equal to the median go to the side with fewer observations, counting the observations below the median and those above it. Because is undefined at time 0, event times at time 0 are not plotted.
When the hazards of two groups are proportional, their curves are parallel, separated vertically by the log hazard ratio. The Kaplan-Meier estimates vary around these curves, and the variation is large at both ends of the curves. Crossings or changes in separation near the ends of the curves can therefore come from sampling variation.
On the scale, the size of the variation is determined mainly by the number of events up to time . By the delta method, the variance of is approximately , where is the size of the risk set at the event time and is the number of events at . At times when the risk set size is nearly constant and is much smaller than , this variance is approximately the reciprocal of the number of events up to . Every group's curve therefore moves by large steps over its first few events, whatever the number of observations in the group. At later times, the variance grows as the risk set shrinks.
The table below the plot shows the number of observations (n) and events (Events) in each group. The table also lists groups whose curves are not drawn, and the event counts include events at time 0. A group with few events has large variation over its whole curve. The table shows totals for each group, so it does not show the size of the risk set at each time.
This parallelism is not the same as the model's proportional hazards assumption. The model's assumption is conditional on all covariates, whereas each curve is estimated within its group and is not adjusted for the other covariates in the model. When other covariates affect the hazard, or a group combines different covariate values as in a median split, the group curves need not be parallel even if the assumption holds. Conversely, parallel curves do not show that the assumption holds.
When a dummy column created with Dummy Coding is selected as the Grouping Variable, the two groups are the observations in that level (coded 1) and the observations not in it (coded 0). When the original variable has two levels, the group coded 0 is the reference category itself, and the two groups compare the same levels as the dummy column's coefficient. The curves, however, are group-specific Kaplan-Meier estimates and are not adjusted for the model's other covariates, so the vertical distance between the two curves need not equal the coefficient estimate. When the original variable has three or more levels, the group coded 0 mixes observations of the reference category with those of the other levels. Even if the hazards of the levels are proportional, the curve of this mixed group need not be parallel to the curve of the group coded 1. In a model that includes all dummy columns of a variable with three or more levels, each dummy column's coefficient compares its level with the reference category, so it compares different levels from these two groups. The scaled Schoenfeld residual plots above can be used to check the proportional hazards assumption for the coefficient of each dummy column.
The median split is a convenience that discards some information from the continuous variable and may miss (or exaggerate) non-proportionality at the continuous scale. For continuous covariates, the Schoenfeld residual plot above is better suited for diagnosing the proportional hazards assumption.
When the diagnostics above suggest a violation of the proportional hazards assumption, approaches such as stratified Cox models or time-dependent covariate models can address it, but MIDAS does not currently support them. Interpret results with care, considering the severity of the violation and the goals of the analysis. If the goal is to compare groups defined by a single categorical variable, Kaplan-Meier with RMST is an alternative that does not rely on the proportional hazards assumption, although it cannot adjust for covariates.
Saving as a Dataset
The coefficients table and the Baseline Cumulative Hazard table can each be saved as a derived dataset with the Save as Dataset button in its heading.
The saved dataset is a derived dataset whose input dataset is the source dataset. The time variable, the event variable, the covariates, and the confidence level at the time of saving are recorded in this dataset. When MIDAS evaluates this dataset, it uses them to fit the Cox model again to the input dataset and builds the row data. When the input dataset changes, for example by Reload Dataset, MIDAS therefore builds the row data again from the new data. When the iterations of the new fit do not converge, MIDAS does not build the table, and the evaluation of the dataset fails with an error. The warning about signs of separation that the tab displays does not accompany the saved dataset.
A value displayed as "-" in the tab is a missing value in the dataset.
Adding to Reports
The Add to Report button in the headings of the coefficients table, Adjusted Survival Curve, and Baseline Cumulative Hazard adds each of them to a report. MIDAS registers the same derived dataset as when the table is saved as a dataset, and the report element displays that dataset. When a derived dataset of the same table already exists, MIDAS uses that dataset instead of registering a new one. The warning about signs of separation that the tab displays does not accompany the report element either.
When the adjusted survival curve is added to a report, the covariate values at the time of clicking Add to Report are recorded in the dataset. When the curve is added with the sample means, MIDAS records the values of the means at that time. The covariate values of the curve in the report therefore stay the same when the source data changes.
The dataset of the adjusted survival curve has the columns Time, Survival Probability, Lower nn%, and Upper nn%. Its rows are a row at time 0 followed by a row at each event time. In the row at time 0, the survival probability and both bounds of the interval are 1.
Notes
- Tied events (multiple events at the same time) are handled using the Efron method (details)
- When the fit does not converge: The iterative computation that maximizes the partial likelihood can stop before meeting the convergence criterion for one of three reasons, and MIDAS shows the applicable reason in a warning. Check for nearly collinear covariates, for a covariate that nearly determines which subject has the event at each event time, and for too few events relative to the number of covariates
- Separation (monotone likelihood): When a covariate separates the event ordering so strongly that its coefficient diverges, the partial likelihood has no finite maximum and the estimate does not exist. Check whether a covariate, or a category of one, perfectly determines which subject has the event at each event time, and whether there are too few events for the number of covariates. Remove or combine the separating covariate, or reduce the number of covariates, then refit
- Signs of separation (warnings): Even when the fit succeeds and returns coefficients with standard errors, estimates on data close to separation may not be reliable. For the terms or combination of covariates the warning points to, the standard errors and confidence intervals cannot be trusted. The detection is tuned conservatively to avoid false warnings on legitimate strong effects, so the absence of a warning does not mean there are no signs of separation. Check the data from the same viewpoints as for the separation error
- Rows with missing values in the time, event, or any covariate variable are automatically excluded (listwise deletion; see Missing Data Mechanisms for validity conditions). When rows are excluded, the results show how many. Rows dropped for a missing time or event value are reported separately from rows dropped for a missing covariate.
See also
- Survival Analysis Fundamentals - Mathematical background of time-to-event data, Kaplan-Meier, and Cox model
- The Kaplan-Meier Tab - Estimating survival curves and comparing groups with RMST
- Tutorial: Kaplan-Meier Analysis - A practical example with sample data
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
Also available as a Markdown file.