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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 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)