Class:GeneralizedLinearMixedModel
Estimates of random effects and related statistics
[[
returns any of the above output arguments using additional options specified by one or moreb
,,,,bnames
,,,,stats
] = randomEffects(glme
,,,,的名字,,,,Value
)的名字,,,,Value
pair arguments. For example, you can specify the confidence interval level, or the method for computing the approximate degrees of freedom.
glme
-Generalized linear mixed-effects modelGeneralizedLinearMixedModel
目的Generalized linear mixed-effects model, specified as aGeneralizedLinearMixedModel
目的。For properties and methods of this object, seeGeneralizedLinearMixedModel
。
Specify optional comma-separated pairs of的名字,,,,Value
arguments.的名字
一世s the argument name andValue
一世s the corresponding value.的名字
must appear inside quotes. You can specify several name and value pair arguments in any order as的名字1,,,,Value1,...,NameN,ValueN
。
一个lpha
-显著性水平显着性水平,指定为逗号分隔对,由'Alpha'
and a scalar value in the range [0,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) |'none'
Method for computing approximate degrees of freedom, specified as the comma-separated pair consisting of'DFMethod'
以及以下内容之一。
Value | Description |
---|---|
'residual' |
The degrees of freedom value is assumed to be constant and equal ton-p,,,,wheren一世s the number of observations andp是固定效果的数量。 |
'none' |
The degrees of freedom is set to infinity. |
Example:'DFMethod','none'
b
——估计empirical Bayes predictors for the random effectsEstimated empirical Bayes predictors (EBPs) for the random effects in the generalized linear mixed-effects modelglme
,,,,returned as a column vector. The EBPs inb
are approximated by the mode of the empirical posterior distribution of the random effects given the estimated covariance parameters and the observed response.
Supposeglme
hasrgrouping variables g1,,,,g2,,,,。。。,,,,gr,,,,with levelsm1,,,,m2,,,,。。。,,,,mr,,,,respectively. Also suppose问1,,,,问2,,,,。。。,,,,问r是与G相关的随机效应向量的长度1,,,,g2,,,,。。。,,,,gr,,,,respectively. Then,b
一世s a column vector of length问1*m1+问2*m2+。。。+问r*mr。
randomEffects
createsb
by concatenating the empirical Bayes predictors of random-effects vectors corresponding to each level of each grouping variable as[[g1level1; g1level2; ...; g1levelm1; g2level1; g2level2; ...; g2levelm2; ...; grlevel1; grlevel2; ...; grlevelmr]'
。
bnames
-的名字s of random-effects coefficients的名字s of random-effects coefficients inb
,,,,returned as a table.
stats
——估计empirical Bayes predictors and related statistics经验贝叶斯估计预测(ebp)和再保险lated statistics for the random effects in the generalized linear mixed-effects modelglme
,,,,returned as a table.stats
has one row for each of the random effects, and one column for each of the following statistics.
Column Name | Description |
---|---|
Group |
Grouping variable associated with the random effect |
Level |
分组变量中的级别对应于随机效果 |
的名字 |
的名字of the random-effect coefficient |
Estimate |
Empirical Bayes predictor (EBP) of random effect |
SEPred |
Square root of the conditional mean squared error of prediction (CMSEP) given covariance parameters and response |
tStat |
t-statistic for a test that the random-effects coefficient is equal to 0 |
DF |
Estimated degrees of freedom for thet-statistic |
pValue |
p-value for thet-statistic |
Lower |
Lower limit of a 95% confidence interval for the random-effects coefficient |
上 |
上limit of a 95% confidence interval for the random-effects coefficient |
randomEffects
computes the confidence intervals using the conditional mean squared error of prediction (CMSEP) approach conditional on the estimated covariance parameters and the observed response. An alternative interpretation of the confidence intervals is that they are approximate Bayesian credible intervals conditional on the estimated covariance parameters and the observed response.
When fitting a GLME model usingfitglme
and one of the pseudo likelihood fit methods ('MPL'
or'REMPL'
),,,,randomEffects
根据最终伪可能迭代的拟合线性混合效应模型计算置信区间和相关统计数据。
Load the sample data.
loadmfr
This simulated data is from a manufacturing company that operates 50 factories across the world, with each factory running a batch process to create a finished product. The company wants to decrease the number of defects in each batch, so it developed a new manufacturing process. To test the effectiveness of the new process, the company selected 20 of its factories at random to participate in an experiment: Ten factories implemented the new process, while the other ten continued to run the old process. In each of the 20 factories, the company ran five batches (for a total of 100 batches) and recorded the following data:
标志指示批处理是否使用新过程(newprocess
)
Processing time for each batch, in hours (t一世me
)
Temperature of the batch, in degrees Celsius (temp
)
表明供应商的分类变量(一个
,,,,b
,,,,orC
批处理中使用的化学物质(supplier
)
批处理中的缺陷次数(defects
)
The data also includest一世me_dev
andtemp_dev
,,,,which represent the absolute deviation of time and temperature, respectively, from the process standard of 3 hours at 20 degrees Celsius.
Fit a generalized linear mixed-effects model usingnewprocess
,,,,t一世me_dev
,,,,temp_dev
,,,,andsupplier
as fixed-effects predictors. Include a random-effects term for intercept grouped byfactory
,以说明由于特定于工厂特定的变化而可能存在的质量差异。响应变量defects
has a Poisson distribution, and the appropriate link function for this model is log. Use the Laplace fit method to estimate the coefficients. Specify the dummy variable encoding as'effects'
,,,,so the dummy variable coefficients sum to 0.
可以使用泊松分布对缺陷的数量进行建模
This corresponds to the generalized linear mixed-effects model
where
是在工厂产生的批处理中观察到的缺陷次数 during batch 。
是对应于工厂的平均缺陷数量 ((where )在批处理期间 ((where )。
,,,, ,,,,and are the measurements for each variable that correspond to factory during batch 。For example, 指示工厂生产的批处理 during batch used the new process.
and
是使用效果(总和到零)编码的虚拟变量来指示公司是否是否C
orb
,,,,respectively, supplied the process chemicals for the batch produced by factory
during batch
。
是每个工厂的随机效应截距 这说明了特定于工厂特定的质量变化。
glme = fitglme(mfr,'defects ~ 1 + newprocess + time_dev + temp_dev + supplier + (1|factory)',,,,'Distribution',,,,'Poisson',,,,'Link',,,,'日志',,,,'FitMethod',,,,'Laplace',,,,'DummyVarCoding',,,,'effects');
Compute and display the names and estimated values of the empirical Bayes predictors (EBPs) for the random effects.
[b,bnames] = randomeffects(glme)
b=20×10.2913 0.1542 -0.2633 -0.4257 0.5453 -0.1069 0.3040 -0.1653 -0.1458 -0.0816⋮
bnames=20×3 table组级别名称___________ ______ ________________ {'factory'} {'1'} {'(intercept)'} {'factory'} {'2'} {'2'} {'(intercept)'} {'factory'} {'3'} {'3'}{'(intercept)'} {'factory'} {'4'} {'(intercept)'} {'factory'} {'5'} {'5'} {'(intercept)'} {'factory'} {'6''} {'(intercept)'} {'factory'} {'7'} {'(intercept)'} {'factric'} {'8'} {'8'} {'(intercept)'} {'factory'} {'9 9'} {'(intercept)'} {'factory'} {'10'} {'(intercept)'} {'factory'} {'11'} {'11'} {'(intercept)'} {'factory'} {'} {'} {'12'} {'(intercept)'} {'factory'} {'13'} {'(intercept)'} {'factric'} {'14'} {'14'} {'(intercept)'} {'factory'} {'} {'15'} {'(intercept)'} {'factory'} {'16'} {'(intercept)'}⋮
Each row ofb
包含在相应行中命名的随机效应系数的估计EPBbnames
。For example, the value –0.2633 in row 3 ofb
一世s the estimated EPB for'(Intercept)'
级别'3'
offactory
。
Load the sample data.
loadmfr
This simulated data is from a manufacturing company that operates 50 factories across the world, with each factory running a batch process to create a finished product. The company wants to decrease the number of defects in each batch, so it developed a new manufacturing process. To test the effectiveness of the new process, the company selected 20 of its factories at random to participate in an experiment: Ten factories implemented the new process, while the other ten continued to run the old process. In each of the 20 factories, the company ran five batches (for a total of 100 batches) and recorded the following data:
标志指示批处理是否使用新过程(newprocess
)
Processing time for each batch, in hours (t一世me
)
Temperature of the batch, in degrees Celsius (temp
)
表明供应商的分类变量(一个
,,,,b
,,,,orC
批处理中使用的化学物质(supplier
)
批处理中的缺陷次数(defects
)
The data also includest一世me_dev
andtemp_dev
,,,,which represent the absolute deviation of time and temperature, respectively, from the process standard of 3 hours at 20 degrees Celsius.
Fit a generalized linear mixed-effects model usingnewprocess
,,,,t一世me_dev
,,,,temp_dev
,,,,andsupplier
as fixed-effects predictors. Include a random-effects term for intercept grouped byfactory
,以说明由于特定于工厂特定的变化而可能存在的质量差异。响应变量defects
has a Poisson distribution, and the appropriate link function for this model is log. Use the Laplace fit method to estimate the coefficients. Specify the dummy variable encoding as'effects'
,,,,so the dummy variable coefficients sum to 0.
可以使用泊松分布对缺陷的数量进行建模
This corresponds to the generalized linear mixed-effects model
where
是在工厂产生的批处理中观察到的缺陷次数 during batch 。
是对应于工厂的平均缺陷数量 ((where )在批处理期间 ((where )。
,,,, ,,,,and are the measurements for each variable that correspond to factory during batch 。For example, 指示工厂生产的批处理 during batch used the new process.
and
是使用效果(总和到零)编码的虚拟变量来指示公司是否是否C
orb
,,,,respectively, supplied the process chemicals for the batch produced by factory
during batch
。
是每个工厂的随机效应截距 这说明了特定于工厂特定的质量变化。
glme = fitglme(mfr,'defects ~ 1 + newprocess + time_dev + temp_dev + supplier + (1|factory)',,,,。。。'Distribution',,,,'Poisson',,,,'Link',,,,'日志',,,,'FitMethod',,,,'Laplace',,,,'DummyVarCoding',,,,'effects');
Compute and display the 99% confidence intervals for the random-effects coefficients.
[[b,,,,bnames,stats] = randomEffects(glme,'Alpha',,,,0。01); stats
stats =随机效应系数:dfmethod ='残留',alpha = 0.01组级别名称估计sepred {'factory'} {'1'} {'} {'(intercept)'} 0.29131 0.19163'(intercept)'} 0.15423 0.19216 {'factory'} {'3'} {'(intercept)'} -0.26325 0.21249 {'factory'} {'4''} {'4'} {'(intercept){'(intercept)'(i机太平)Factory'} {'5'} {'(intercept)'} 0.5453 0.17963 {'factory'} {'6'} {'(intercept)'} -10692 0.20133 {截距)'} 0.30404 0.18397 {'factory'} {'8'} {'(intercept)'} -0.16527 0.20505 {'factory'} {'9'} {'9'} {'(intercept){'(intercept)'} -0.14577 0.203 {'''''''''}} {'10'} {'(intercept)'} -0.081632 0.20256 {'factory'} {'11'} {'(intercept)'} 0.014529 0.21421 {'} 0.17706 0.20721 {'factory'} {'13'} {'(intercept)'} 0.24872 0.20522 {'factory'} {'14'} {'14'} {'(intercept)'} 0.21145 0.21145 0.2145 0.20678 {''}'}'}'}'} '15'} {'(Intercept)'} 0.2777 0.20345 {'factory'} {'16'} {'(intercept)'} -0.25175 0.22568 0.22568 {'factory'} {'17'}0.22301 {'factory'} {'18'} {'(截距)'} -0.1627 0.22269 {'factory'} {'19'} {'(intercept)'} -0.32083 0.23294 {'factory'} {'20'}'}'} {'20'} {'(intercept)'(intercept)'} 0.058418 0.218 0.21418 0.21481 TSTAT DSTSTAT DFPVALUEUpper 1.5202 94 0.13182 -0.21251 0.79514 0.80259 94 0.42423 -0.351 0.65946 -1.2389 94 0.21846 -0.82191 0.29541 -1.9646 94 0.052408 -0.99534 0.14398 3.0356 94 0.0031051 0.073019 1.0176 -0.53105 94 0.59664 -0.63625 0.42241 1.6527 94 0.10173 -0.17964 0.78771 -0.80597 94 0.42229 -0。70438 0.37385 -0.71806 94 0.4745 -0.67949 0.38795 -0.403 94 0.68786 -0.61419 0.45093 0.067826 94 0.94607 -0.54866 0.57772 0.85446 94 0.39502 -0.36774 0.72185 1.212 94 0.22857 -0.29083 0.78827 1.0226 94 0.30913 -0.33221 0.75511 1.365 94 0.17552 -0.25719 0.81259 -1.1156 94 0.26746 -0.84509 0.34158 -0.60568 94 0.54619 -0.7214 0.45125 -0.73061 94 0.46684 -0.74817 0.42278 -1.3773 94 0.17168 -0.93325 0.29159 0.27195 94 0.78626 -0.50635 0.62319
前三列stats
包含组名称,级别和随机效应系数名称。第4列包含随机效应系数的估计EBP。最后两列stats
,,,,Lower
and上
,,,,contain the lower and upper bounds of the 99% confidence interval, respectively. For example, for the coefficient for'(Intercept)'
级别3
offactory
,,,,the estimated EBP is -0.26325, and the 99% confidence interval is [-0.82191,0.29541].
[[1] Booth, J.G., and J.P. Hobert. “Standard Errors of Prediction in Generalized Linear Mixed Models.”Journal of the American Statistical Association,,,,Vol. 93, 1998, pp. 262–272.
You have a modified version of this example. Do you want to open this example with your edits?
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.
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:。
Selectweb siteYou can also select a web site from the following list:
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。