coefCI
Confidence intervals of coefficient estimates for censored linear regression model
Since R2025a
Description
Examples
Load the readmissiontimes
sample data.
load readmissiontimes
The variables Age
, Weight
, Smoker
, and ReadmissionTime
contain data for patient age, weight, smoking status, and time of readmission. The Censored
variable contains censoring information for ReadmissionTime
.
Save Age
, Weight
, Smoker
, and ReadmissionTime
in a table, and fit a censored linear regression model to the data.
tbl = table(Age,Weight,Smoker,ReadmissionTime); mdl = fitlmcens(tbl,Censoring=Censored);
View the names of the coefficients.
mdl.CoefficientNames
ans = 1×4 cell
{'(Intercept)'} {'Age'} {'Weight'} {'Smoker'}
Calculate the confidence intervals for the model coefficients.
ci = coefCI(mdl)
ci = 4×2
20.9887 34.4918
-0.1716 0.0647
-0.1444 -0.0776
-4.1938 -0.4971
Load the readmissiontimes
sample data.
load readmissiontimes
The variables Age
, Weight
, Smoker
, and ReadmissionTime
contain data for patient age, weight, smoking status, and time of readmission. The Censored
variable contains censoring information for ReadmissionTime
.
Save Age
, Weight
, Smoker
, and ReadmissionTime
in a table, and fit a censored linear regression model to the data.
tbl = table(Age,Weight,Smoker,ReadmissionTime); mdl = fitlmcens(tbl,Censoring=Censored);
Find the 99% confidence intervals for the coefficients.
ci = coefCI(mdl,.01)
ci = 4×2
18.8009 36.6796
-0.2099 0.1030
-0.1552 -0.0668
-4.7928 0.1019
The confidence intervals are wider than the default 95% confidence intervals in the example Find Confidence Intervals for Model Coefficients.
Input Arguments
Censored linear regression model, specified as a CensoredLinearModel
object
created using fitlmcens
,
or a CompactCensoredLinearModel
object created using
fitlmcens
and compact
.
Significance level for the confidence interval,s specified as a numeric value in the
range [0,1]. The confidence level of ci
is equal to 100(1 – alpha
)%. alpha
is the probability that the confidence
intervals do not contain the true value.
Example: 0.01
Data Types: single
| double
Output Arguments
Confidence intervals, returned as a k-by-2 numeric matrix, where
k is the number of coefficients. The jth row
of ci
is the confidence interval of the jth
coefficient of mdl
. The name of coefficient j is
stored in the CoefficientNames
property of
mdl
.
Data Types: single
| double
More About
The coefficient confidence intervals provide a measure of precision for regression coefficient estimates.
A 100(1 – α)% confidence interval gives the range for the corresponding regression coefficient with 100(1 – α)% confidence, meaning that 100(1 – α)% of the intervals resulting from repeated experimentation will contain the true value of the coefficient.
The software finds confidence intervals using the Wald method. The 100(1 – α)% confidence intervals for regression coefficients are
where bi is the coefficient estimate, SE(bi) is the standard error of the coefficient estimate, and t(1–α/2,n–p) is the 100(1 – α/2) percentile of the t-distribution with n – p degrees of freedom. n is the number of observations and p is the number of regression coefficients.
Version History
Introduced in R2025a
See Also
fitlmcens
| CensoredLinearModel
| CompactCensoredLinearModel
| coefTest
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)