coefCI
Class:LinearMixedModel
Confidence intervals for coefficients of linear mixed-effects model
Description
returns the 95% confidence intervals for the fixed-effects coefficients in the linear mixed-effects modelfeCI
= coefCI(lme三个月
,Name,Value
)lme三个月
with additional options specified by one or moreName,Value
pair arguments.
For example, you can specify the confidence level or method to compute the degrees of freedom.
Input Arguments
lme三个月
—Linear mixed-effects model
LinearMixedModel
object
Linear mixed-effects model, specified as aLinearMixedModel
object constructed usingfitlme
orfitlmematrix
.
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
Before R2021a, use commas to separate each name and value, and encloseName
in quotes.
Alpha
—Significance level
0.05(default) |scalar value in the range 0 to 1
Significance level, specified as the comma-separated pair consisting of'Alpha'
and a scalar value in the range 0 to 1. For a value α, the confidence level is 100*(1–α)%.
For example, for 99% confidence intervals, you can specify the confidence level as follows.
Example:'Alpha',0.01
Data Types:single
|double
DFMethod
—Method for computing approximate degrees of freedom
'residual'
(default) |'satterthwaite'
|'none'
Method for computing approximate degrees of freedom for confidence interval computation, specified as the comma-separated pair consisting of'DFMethod'
and one of the following.
'residual' |
Default. The degrees of freedom are assumed to be constant and equal ton–p, wherenis the number of observations andpis the number of fixed effects. |
'satterthwaite' |
Satterthwaite approximation. |
'none' |
All degrees of freedom are set to infinity. |
For example, you can specify the Satterthwaite approximation as follows.
Example:'DFMethod','satterthwaite'
Output Arguments
feCI
— Fixed-effects confidence intervals
p-by-2 matrix
Fixed-effects confidence intervals, returned as ap-by-2 matrix.feCI
contains the confidence limits that correspond to thepfixed-effects estimates in the vectorbeta
returned by thefixedEffects
method. The first column offeCI
has the lower confidence limits and the second column has the upper confidence limits.
reCI
— Random-effects confidence intervals
q-by-2 matrix
Random-effects confidence intervals, returned as aq-by-2 matrix.reCI
contains the confidence limits corresponding to theqrandom-effects estimates in the vectorB
returned by therandomEffects
method. The first column ofreCI
has the lower confidence limits and the second column has the upper confidence limits.
Examples
95% Confidence Intervals for Fixed-Effects Coefficients
Load the sample data.
load('weight.mat')
weight
contains data from a longitudinal study, where 20 subjects are randomly assigned to 4 exercise programs, and their weight loss is recorded over six 2-week time periods. This is simulated data.
Store the data in a table. DefineSubject
andProgram
as categorical variables.
tbl = table(InitialWeight, Program, Subject,Week, y); tbl.Subject = nominal(tbl.Subject); tbl.Program = nominal(tbl.Program);
Fit a linear mixed-effects model where the initial weight, type of program, week, and the interaction between the week and type of program are the fixed effects. The intercept and week vary by subject.
lme三个月= fitlme(tbl,'y ~ InitialWeight + Program*Week + (Week|Subject)');
计算the fixed-effects coefficient estimates.
fe = fixedEffects(lme)
fe =9×10.6610 0.0032 0.3608 -0.0333 0.1132 0.1732 0.0388 0.0305 0.0331
The first estimate, 0.6610, corresponds to the constant term. The second row, 0.0032, and the third row, 0.3608, are estimates for the coefficient of initial weight and week, respectively. Rows four to six correspond to the indicator variables for programs B-D, and the last three rows correspond to the interaction of programs B-D and week.
计算the 95% confidence intervals for the fixed-effects coefficients.
fecI = coefCI (lme)
fecI =9×20.1480 1.1741 0.0005 0.0059 0.1004 0.6211 -0.2932 0.2267 -0.1471 0.3734 0.0395 0.3069 -0.1503 0.2278 -0.1585 0.2196 -0.1559 0.2221
Some confidence intervals include 0. To obtain specific
-values for each fixed-effects term, use thefixedEffects
method. To test for entire terms use theanova
method.
Confidence Intervals with Specified Options
Load the sample data.
loadcarbig
Fit a linear mixed-effects model for miles per gallon (MPG), with fixed effects for acceleration and horsepower, and a potentially correlated random effect for intercept and acceleration grouped by model year. First, store the data in a table.
tbl = table(Acceleration,Horsepower,Model_Year,MPG);
Fit the model.
lme三个月= fitlme(tbl,'MPG ~ Acceleration + Horsepower + (Acceleration|Model_Year)');
计算the fixed-effects coefficient estimates.
fe = fixedEffects(lme)
fe =3×150.1325 -0.5833 -0.1695
计算the 99% confidence intervals for fixed-effects coefficients using the residuals method to determine the degrees of freedom. This is the default method.
feCI = coefCI(lme,'Alpha',0.01)
feCI =3×244.2690 55.9961 -0.9300 -0.2365 -0.1883 -0.1507
计算the 99% confidence intervals for fixed-effects coefficients using the Satterthwaite approximation to compute the degrees of freedom.
feCI = coefCI(lme,'Alpha',0.01,'DFMethod','satterthwaite')
feCI =3×244.0949 56.1701 -0.9640 -0.2025 -0.1884 -0.1507
The Satterthwaite approximation produces similar confidence intervals than the residual method.
Compute Confidence Intervals for Random Effects
Load the sample data.
load('shift.mat')
The data shows the deviations from the target quality characteristic measured from the products that five operators manufacture during three shifts: morning, evening, and night. This is a randomized block design, where the operators are the blocks. The experiment is designed to study the impact of the time of shift on the performance. The performance measure is the deviation of the quality characteristics from the target value. This is simulated data.
Shift
andOperator
are nominal variables.
shift.Shift = nominal(shift.Shift); shift.Operator = nominal(shift.Operator);
Fit a linear mixed-effects model with a random intercept grouped by operator to assess if there is significant difference in the performance according to the time of the shift.
lme三个月= fitlme(shift,'QCDev ~ Shift + (1|Operator)');
计算the estimate of the BLUPs for random effects.
randomEffects(lme)
ans =5×10.5775 1.1757 -2.1715 2.3655 -1.9472
计算the 95% confidence intervals for random effects.
[~,reCI] = coefCI(lme)
reCI =5×2-1.3916 2.5467 -0.7934 3.1449 -4.1407 -0.2024 0.3964 4.3347 -3.9164 0.0219
计算the 99% confidence intervals for random effects using the residuals method to determine the degrees of freedom. This is the default method.
[~,reCI] = coefCI(lme,'Alpha',0.01)
reCI =5×2-2.1831 3.3382 -1.5849 3.9364 -4.9322 0.5891 -0.3951 5.1261 -4.7079 0.8134
计算the 99% confidence intervals for random effects using the Satterthwaite approximation to determine the degrees of freedom.
[~,reCI] = coefCI(lme,'Alpha',0.01,'DFMethod','satterthwaite')
reCI =5×2-2.6840 3.8390 -2.0858 4.4372 -5.4330 1.0900 -0.8960 5.6270 -5.2087 1.3142
The Satterthwaite approximation might produce smallerDF
values than the residual method. That is why these confidence intervals are larger than the previous ones computed using the residual method.
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)