GeneralizedLinearMixedModel.fixedEffects - Estimates of fixed effects and related statistics - MATLAB (original) (raw)
Class: GeneralizedLinearMixedModel
Estimates of fixed effects and related statistics
Syntax
Description
[beta](#bubtn%5Fn-beta) = fixedEffects([glme](#bubtn%5Fn%5Fsep%5Fshared-glme))
returns the estimated fixed-effects coefficients, beta
, of the generalized linear mixed-effects model glme
.
[[beta](#bubtn%5Fn-beta),[betanames](#bubtn%5Fn-betanames)] = fixedEffects([glme](#bubtn%5Fn%5Fsep%5Fshared-glme))
also returns the names of estimated fixed-effects coefficients in betanames
. Each name corresponds to a fixed-effects coefficient in beta
.
[[beta](#bubtn%5Fn-beta),[betanames](#bubtn%5Fn-betanames),[stats](#bubtn%5Fn-stats)] = fixedEffects([glme](#bubtn%5Fn%5Fsep%5Fshared-glme))
also returns a table of statistics, stats
, related to the estimated fixed-effects coefficients of glme
.
[___] = fixedEffects([glme](#bubtn%5Fn%5Fsep%5Fshared-glme),[Name,Value](#namevaluepairarguments))
returns any of the output arguments in previous syntaxes using additional options specified by one or more Name,Value
pair arguments. For example, you can specify the confidence level, or the method for computing the approximate degrees of freedom for the _t_-statistic.
Input Arguments
Generalized linear mixed-effects model, specified as a GeneralizedLinearMixedModel
object. For properties and methods of this object, see GeneralizedLinearMixedModel.
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, where Name
is the argument name and Value
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 enclose Name
in quotes.
Data Types: single
| double
Output Arguments
Estimated fixed-effects coefficients of the fitted generalized linear mixed-effects model glme
, returned as a vector.
Names of fixed-effects coefficients in beta, returned as a table.
Fixed-effects estimates and related statistics, returned as a dataset array that has one row for each of the fixed effects and one column for each of the following statistics.
Column Name | Description |
---|---|
Name | Name of the fixed-effects coefficient |
Estimate | Estimated coefficient value |
SE | Standard error of the estimate |
tStat | _t_-statistic for a test that the coefficient is 0 |
DF | Estimated degrees of freedom for the _t_-statistic |
pValue | _p_-value for the _t_-statistic |
Lower | Lower limit of a 95% confidence interval for the fixed-effects coefficient |
Upper | Upper limit of a 95% confidence interval for the fixed-effects coefficient |
When fitting a model using fitglme and one of the maximum likelihood fit methods ('Laplace'
or 'ApproximateLaplace'
), if you specify the 'CovarianceMethod'
name-value pair argument as 'conditional'
, then SE
does not account for the uncertainty in estimating the covariance parameters. To account for this uncertainty, specify 'CovarianceMethod'
as 'JointHessian'
.
When fitting a GLME model using fitglme
and one of the pseudo likelihood fit methods ('MPL'
or 'REMPL'
), fixedEffects
bases the fixed effects estimates and related statistics on the fitted linear mixed-effects model from the final pseudo likelihood iteration.
Examples
Load the sample data.
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 (
A
,B
, orC
) of the chemical used in the batch (supplier
) - Number of defects in the batch (
defects
)
The data also includes time_dev
and temp_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 using newprocess
, time_dev
, temp_dev
, and supplier
as fixed-effects predictors. Include a random-effects term for intercept grouped by factory
, to account for quality differences that might exist due to factory-specific variations. The response variable 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.
The number of defects can be modeled using a Poisson distribution
defectsij∼Poisson(μij)
This corresponds to the generalized linear mixed-effects model
log(μij)=β0+β1newprocessij+β2time_devij+β3temp_devij+β4supplier_Cij+β5supplier_Bij+bi,
where
- defectsij is the number of defects observed in the batch produced by factory i during batch j.
- μij is the mean number of defects corresponding to factory i (where i=1,2,...,20) during batch j (where j=1,2,...,5).
- newprocessij, time_devij, and temp_devij are the measurements for each variable that correspond to factory i during batch j. For example, newprocessij indicates whether the batch produced by factory i during batch j used the new process.
- supplier_Cij and supplier_Bij are 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 factory i during batch j. - bi∼N(0,σb2) is a random-effects intercept for each factory i that 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');
Compute and display the estimated fixed-effects coefficient values and related statistics.
[beta,betanames,stats] = fixedEffects(glme); stats
stats = Fixed effect coefficients: DFMethod = 'residual', Alpha = 0.05
Name Estimate SE tStat DF pValue Lower Upper
{'(Intercept)'} 1.4689 0.15988 9.1875 94 9.8194e-15 1.1515 1.7864
{'newprocess' } -0.36766 0.17755 -2.0708 94 0.041122 -0.72019 -0.015134
{'time_dev' } -0.094521 0.82849 -0.11409 94 0.90941 -1.7395 1.5505
{'temp_dev' } -0.28317 0.9617 -0.29444 94 0.76907 -2.1926 1.6263
{'supplier_C' } -0.071868 0.078024 -0.9211 94 0.35936 -0.22679 0.083051
{'supplier_B' } 0.071072 0.07739 0.91836 94 0.36078 -0.082588 0.22473
The returned results indicate, for example, that the estimated coefficient for temp_dev
is –0.28317. Its large p-value, 0.76907, indicates that it is not a statistically significant predictor at the 5% significance level. Additionally, the confidence interval boundaries Lower
and Upper
indicate that the 95% confidence interval for the coefficient for temp_dev
is [-2.1926 , 1.6263]. This interval contains 0, which supports the conclusion that temp_dev
is not statistically significant at the 5% significance level.