AnovaMixedModels.jl
AnovaBase.anova — Methodanova(<mixedmodels>...; test::Type{<: GoodnessOfFit}, <keyword arguments>)
anova(<anovamodel>; test::Type{<: GoodnessOfFit}, <keyword arguments>)
anova(test::Type{<: GoodnessOfFit}, <mixedmodels>...; <keyword arguments>)
anova(test::Type{<: GoodnessOfFit}, <anovamodel>; <keyword arguments>)Analysis of variance.
Return AnovaResult{M, test, N}. See AnovaResult for details.
Arguments
- mixedmodels: model objects- LinearMixedModelfitted by- AnovaMixedModels.lmeor- fit(LinearMixedModel, ...)
- GeneralizedLinearMixedModelfitted by- AnovaMixedModels.glmeor- fit(GeneralizedLinearMixedModel, ...)
 - GLMobject without random effects.
- anovamodel: wrapped model objects;- FullModeland- NestedModels.
- test: test statistics for goodness of fit. Available tests are- LikelihoodRatioTest(- LRT) and- FTest. The default is based on the model type.- LinearMixedModel:- FTestfor one model;- LRTfor nested models.
- GeneralizedLinearMixedModel:- LRTfor nested models.
 
Other keyword arguments
- When one model is provided:  - type: type of anova (1, 2 or 3). Default value is 1.
- adjust_sigma: whether adjust σ to match that of linear mixed-effect model fitted by REML. The result will be slightly deviated from that of model fitted by REML.
 
- When multiple models are provided:  - check: allows to check if models are nested. Defalut value is true. Some checkers are not implemented now.
 
For fitting new models and conducting anova at the same time, see anova_lme for LinearMixedModel.
The result with adjust_sigma will be slightly deviated from that of model fitted directly by REML.
For the computation of degrees of freedom, please see dof_residual_pred.
AnovaMixedModels.anova_lme — Functionanova_lme(f::FormulaTerm, tbl; test::Type{<: GoodnessOfFit} = FTest, <keyword arguments>)
anova_lme(test::Type{<: GoodnessOfFit}, f::FormulaTerm, tbl; <keyword arguments>)
anova(test::Type{<: GoodnessOfFit}, ::Type{<: LinearMixedModel}, f::FormulaTerm, tbl; <keyword arguments>)ANOVA for linear mixed-effect models.
Arguments
- f: a- Formula.
- tbl: a- Tables.jlcompatible data.
- test:- GoodnessOfFit. The default is- FTest.
Keyword arguments
- test:- GoodnessOfFit. The default is- FTest.
- type: type of anova (1, 2 or 3). Default value is 1.
- adjust_sigma: whether adjust σ to match that of linear mixed-effect model fitted by REML. The result will be slightly deviated from that of model fitted by REML.
Other keyword arguments
- wts = []
- contrasts = Dict{Symbol,Any}()
- progress::Bool = true
- REML::Bool = true
anova_lme generate a LinearMixedModel fitted with REML if applying FTest; otherwise, a model fitted with ML.
The result with adjust_sigma will be slightly deviated from that of model fitted directly by REML.
AnovaBase.nestedmodels — Methodnestedmodels(model::LinearMixedModel; null::Bool = true, <keyword arguments>)
nestedmodels(::Type{LinearMixedModel}, f::FormulaTerm, tbl; null::Bool = true, wts = [], contrasts = Dict{Symbol, Any}(), verbose::Bool = false, REML::Bool = false)Generate nested models from a model or modeltype, formula and data. The null model will be an empty model if the keyword argument null is true (default).
AnovaMixedModels.lme — Functionlme(f::FormulaTerm, tbl; wts, contrasts, progress, REML)An alias for fit(LinearMixedModel, f, tbl; wts, contrasts, progress, REML).
AnovaMixedModels.glme — Functionglme(f::FormulaTerm, tbl, d::Distribution, l::Link; kwargs...)An alias for fit(GeneralizedLinearMixedModel, f, tbl, d, l; kwargs...)
AnovaMixedModels.dof_residual_pred — Functiondof_residual_pred(model::LinearMixedModel)
dof_residual_pred(aovm::FullModel{LinearMixedModel})Compute degrees of freedom (DOF) of residuals for each predictors in a linear mixed effect models.
DOF of residuals are estimated by between-within method. For details, please refer to the documentation or GLMM FAQ for details.
To be noticed, my implementation is a little different from the reference one. When intercept is not in fix effects, the reference algorithm regards the first term as intercept; however, there is no such replacement here.