coefci
Description
Examples
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
Log-likelihood: -212.638
Find a 95% confidence interval for the returned Beta estimate.
ci = coefci(coxMdl)
ci = 1×2
2.6934 6.7590
Find a 99% confidence interval for the Beta estimate.
ci99 = coefci(coxMdl,0.01)
ci99 = 1×2
2.0546 7.3978
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 Age, Sex, Weight, and 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.
load readmissiontimesUse 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 Age, Sex, Weight, and Smoker coefficients.
coxMdl.Coefficients.Beta
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
The 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 Age and Sex predictors are zero.
Input Arguments
Level of significance for the confidence interval, specified as a positive number
less than 1. The resulting percentage is 100(1 –
level)%. For example, for a 99% confidence interval, specify
level as 0.01.
Example: 0.01
Data Types: double
Output Arguments
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 level
is 0.05, so with no level specified, the
probability that each predictor lies in its row of ci is 95%.
Version History
Introduced in R2021a
See Also
CoxModel | linhyptest | fitcox
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)