Confidence interval for Cox proportional hazards model coefficients
Cox Model Confidence Interval
Perform a Cox proportional hazards regression on the
lightbulb data set, which contains simulated lifetimes of light bulbs. The first column of the light bulb data contains the lifetime (in hours) of two different types of bulbs. The second column contains a binary variable indicating whether the bulb is fluorescent or incandescent; 0 indicates the bulb is fluorescent, and 1 indicates it is incandescent. The third column contains the censoring information, where 0 indicates the bulb was observed until failure, and 1 indicates the observation was censored.
Fit a Cox proportional hazards model for the lifetime of the light bulbs, accounting for censoring. The predictor variable is the type of bulb.
load lightbulb coxMdl = fitcox(lightbulb(:,2),lightbulb(:,1), ... 'Censoring',lightbulb(:,3))
coxMdl = Cox Proportional Hazards regression model: Beta SE zStat pValue ______ ______ ______ __________ X1 4.7262 1.0372 4.5568 5.1936e-06
Find a 95% confidence interval for the returned
ci = coefci(coxMdl)
ci = 1×2 2.6934 6.7590
Find a 99% confidence interval for the
ci99 = coefci(coxMdl,0.01)
ci99 = 1×2 2.0546 7.3978
Confidence Intervals for Multiple Predictors
Find confidence intervals for predictors of the
readmissiontimes data set. The response variable is
ReadmissionTime, which shows the readmission times for 100 patients. The predictor variables are
Smoker, the smoking status of each patient. A 1 indicates the patient is a smoker, and a 0 indicates the patient does not smoke. The column vector
Censored contains the censorship information for each patient, where 1 indicates censored data, and 0 indicates the exact readmission times are observed. (This data is simulated.)
Load the data.
Use all four predictors for fitting a model.
X = [Age Sex Weight Smoker];
Fit the model using the censoring information.
coxMdl = fitcox(X,ReadmissionTime,'censoring',Censored);
View the point estimates for the
ans = 4×1 0.0184 -0.0676 0.0343 0.8172
Find 95% confidence intervals for these estimates.
ci = coefci(coxMdl)
ci = 4×2 -0.0139 0.0506 -1.6488 1.5136 0.0042 0.0644 0.2767 1.3576
Sex coefficient (second row) has a large confidence interval, and the first two coefficients bracket the value 0. Therefore, you cannot reject the hypothesis that the
Sex predictors are zero.
level — Level of significance for confidence interval
0.05 (default) | positive number less than
Level of significance for the confidence interval, specified as a positive number
1. The resulting percentage is 100(1 –
level)%. For example, for a 99% confidence interval, specify
ci — Confidence interval
real two-column matrix
Confidence interval, returned as a real two-column matrix. Each row of the matrix is
a confidence interval for the corresponding predictor. The probability that the true
predictor coefficient lies in its confidence interval is 100(1 –
level)%. For example, the default value of
0.05, so with no
level specified, the
probability that each predictor lies in its row of
ci is 95%.