fitglme
statistics: glme = fitglme (tbl, formula)
statistics: glme = fitglme (…, name, value)
Fit a generalized linear mixed-effects model specified by a formula.
fitglme (tbl, formula) fits the generalized linear
mixed-effects model described by formula to the table tbl and
returns a GeneralizedLinearMixedModel object.
formula uses the same syntax as fitlme: a response, a
fixed-effects part, and one or more random-effects terms
(expr | group), for example
"y ~ x + (1 | g)". The model is fitted by penalized
quasi-likelihood.
The following name/value pairs are accepted:
"Distribution""normal" (default), "binomial", or
"poisson"."Link""identity", "logit", or "log".
The default is the canonical link of the chosen distribution."FitMethod""MPL" (maximum pseudo-likelihood, the default), "REMPL"
(restricted MPL), "Laplace", or "ApproximateLaplace". The
first two differ in the pseudo-likelihood used for the covariance parameters;
the last two report the Laplace-approximated marginal log-likelihood.Only the canonical links and the full (unstructured) random-effects covariance are currently supported.
See also: GeneralizedLinearMixedModel, fitlme, fitglm
Source Code: fitglme
Poisson mixed model with a random intercept per group.
g = reshape (repmat (1:6, 7, 1), [], 1); x = randn (42, 1); y = poissrnd (exp (0.3 + 0.5 * x + 0.2 * reshape (repmat (randn (1, 6), 7, 1), [], 1))); tbl = table (y, x, g); glme = fitglme (tbl, "y ~ x + (1 | g)", "Distribution", "poisson"); disp (glme.Coefficients);
2x7 table
Estimate SE tStat DF pValue Lower Upper
________ ________ _______ __ ___________ _________ ________
(Intercept) 0.222653 0.208574 1.0675 40 0.292147 -0.198892 0.644198
x 0.450411 0.124099 3.62946 40 0.000796764 0.199598 0.701224