Syntax
disp(glme)
Input Arguments
glme
— Generalized linear mixed-effects model
GeneralizedLinearMixedModel
object
Generalized linear mixed-effects model, specified as aGeneralizedLinearMixedModel
object. For properties and methods of this object, seeGeneralizedLinearMixedModel
.
Examples
Display a Generalized Linear Mixed-Effects Model
Navigate to the folder containing the sample data. Load the sample data.
cd(matlabroot) cd('help/toolbox/stats/examples') 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:
Flag to indicate whether the batch used the new process (
newprocess
)Processing time for each batch, in hours (
time
)Temperature of the batch, in degrees Celsius (
temp
)Categorical variable indicating the supplier of the chemical used in the batch (
supplier
)Number of defects in the batch (
defects
)
The data also includestime_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
,time_dev
,temp_dev
, andsupplier
as fixed-effects predictors. Include a random-effects term for intercept grouped byfactory
, to account for quality differences that might exist due to factory-specific variations. The response variabledefects
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.
The number of defects can be modeled using a Poisson distribution
This corresponds to the generalized linear mixed-effects model
where
is the number of defects observed in the batch produced by factoryduring batch.
is the mean number of defects corresponding to factory(where) during batch(where).
,, andare the measurements for each variable that correspond to factoryduring batch. For example,indicates whether the batch produced by factoryduring batchused the new process.
andare dummy variables that use effects (sum-to-zero) coding to indicate whether company
C
orB
, respectively, supplied the process chemicals for the batch produced by factoryduring batch.is a random-effects intercept for each factorythat accounts for factory-specific variation in quality.
glme = fitglme(mfr,'defects ~ 1 + newprocess + time_dev + temp_dev + supplier + (1|factory)','Distribution','Poisson','Link','log','FitMethod','Laplace','DummyVarCoding','effects');
Display the model.
disp(glme)
Generalized linear mixed-effects model fit by ML Model information: Number of observations 100 Fixed effects coefficients 6 Random effects coefficients 20 Covariance parameters 1 Distribution Poisson Link Log FitMethod Laplace Formula: defects ~ 1 + newprocess + time_dev + temp_dev + supplier + (1 | factory) Model fit statistics: AIC BIC LogLikelihood Deviance 416.35 434.58 -201.17 402.35 Fixed effects coefficients (95% CIs): Name Estimate SE tStat DF pValue '(Intercept)' 1.4689 0.15988 9.1875 94 9.8194e-15 'newprocess' -0.36766 0.17755 -2.0708 94 0.041122 'time_dev' -0.094521 0.82849 -0.11409 94 0.90941 'temp_dev' -0.28317 0.9617 -0.29444 94 0.76907 'supplier_C' -0.071868 0.078024 -0.9211 94 0.35936 'supplier_B' 0.071072 0.07739 0.91836 94 0.36078 Lower Upper 1.1515 1.7864 -0.72019 -0.015134 -1.7395 1.5505 -2.1926 1.6263 -0.22679 0.083051 -0.082588 0.22473 Random effects covariance parameters: Group: factory (20 Levels) Name1 Name2 Type Estimate '(Intercept)' '(Intercept)' 'std' 0.31381 Group: Error Name Estimate 'sqrt(Dispersion)' 1
TheModel information
table displays the total number of observations in the sample data (100), the number of fixed- and random-effects coefficients (6 and 20, respectively), and the number of covariance parameters (1). It also indicates that the response variable has aPoisson
distribution, the link function isLog
, and the fit method isLaplace
.
Formula
indicates the model specification using Wilkinson's notation.
TheModel fit statistics
table displays statistics used to assess the goodness of fit of the model. This includes the Akaike information criterion (AIC
), Bayesian information criterion (BIC
) values, log likelihood (LogLikelihood
), and deviance (Deviance
) values.
TheFixed effects coefficients
table indicates thatfitglme
returned 95% confidence intervals. It contains one row for each fixed-effects predictor, and each column contains statistics corresponding to that predictor. Column 1 (Name
) contains the name of each fixed-effects coefficient, column 2 (Estimate
) contains its estimated value, and column 3 (SE
) contains the standard error of the coefficient. Column 4 (tStat
) contains the-statistic for a hypothesis test that the coefficient is equal to 0. Column 5 (DF
) and column 6 (pValue
) contain the degrees of freedom and-value that correspond to the-statistic, respectively. The last two columns (Lower
andUpper
) display the lower and upper limits, respectively, of the 95% confidence interval for each fixed-effects coefficient.
Random effects covariance parameters
displays a table for each grouping variable (here, onlyfactory
),包括水平(20)的总数,和the type and estimate of the covariance parameter. Here,std
indicates thatfitglme
returns the standard deviation of the random effect associated with the factory predictor, which has an estimated value of 0.31381. It also displays a table containing the error parameter type (here, the square root of the dispersion parameter), and its estimated value of 1.
The standard display generated byfitglme
does not provide confidence intervals for the random-effects parameters. To compute and display these values, usecovarianceParameters
.
Definitions
Akaike and Bayesian Information Criteria
TheAkaike information criterion(AIC) isAIC= –2logLM+ 2(param).
logLMdepends on the method used to fit the model.
If you use
'Laplace'
or'ApproximateLaplace'
, thenlogLMis the maximized log likelihood.If you use
'MPL'
, thenlogLMis the maximized log likelihood of the pseudo data from the final pseudo likelihood iteration.If you use
'REMPL'
, thenlogLMis the maximized restricted log likelihood of the pseudo data from the final pseudo likelihood iteration.
paramis the total number of parameters estimated in the model. For most GLME models,paramis equal tonc+p+ 1, wherenc参数的总数是random-ef吗fects covariance, excluding the residual variance, andpis the number of fixed-effects coefficients. However, if the dispersion parameter is fixed at 1.0 for binomial or Poisson distributions, thenparamis equal to(nc+p).
TheBayesian information criterion(BIC) isBIC= –2*logLM+ ln(neff)(param).
logLMdepends on the method used to fit the model.
If you use
'Laplace'
or'ApproximateLaplace'
, thenlogLMis the maximized log likelihood.If you use
'MPL'
, thenlogLMis the maximized log likelihood of the pseudo data from the final pseudo likelihood iteration.If you use
'REMPL'
, thenlogLMis the maximized restricted log likelihood of the pseudo data from the final pseudo likelihood iteration.
neffis the effective number of observations.
If you use
'MPL'
,'Laplace'
, or'ApproximateLaplace'
, thenneff=n, wherenis the number of observations.If you use
'REMPL'
, thenneff=n–p.
paramis the total number of parameters estimated in the model. For most GLME models,paramis equal tonc+p+ 1, wherenc参数的总数是random-ef吗fects covariance, excluding the residual variance, andpis the number of fixed-effects coefficients. However, if the dispersion parameter is fixed at 1.0 for binomial or Poisson distributions, thenparamis equal to(nc+p).
A lower value of deviance indicates a better fit. As the value of deviance decreases, both AIC and BIC tend to decrease. Both AIC and BIC also include penalty terms based on the number of parameters estimated,p. So, when the number of parameters increase, the values of AIC and BIC tend to increase as well. When comparing different models, the model with the lowest AIC or BIC value is considered as the best fitting model.
For models fitted using'MPL'
and'REMPL'
, AIC and BIC are based on the log likelihood (or restricted log likelihood) of pseudo data from the final pseudo likelihood iteration. Therefore, a direct comparison of AIC and BIC values between models fitted using'MPL'
and'REMPL'
is not appropriate.
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)