anova(<lfemodels>...; test::Type{<: GoodnessOfFit})
anova(<anovamodel>; test::Type{<: GoodnessOfFit})
anova(test::Type{<: GoodnessOfFit}, <lfemodels>...;  <keyword arguments>)
anova(test::Type{<: GoodnessOfFit}, <anovamodel>;  <keyword arguments>)

Analysis of variance.

Return AnovaResult{M, test, N}. See AnovaResult for details.


  • lfemodels: model objects
    • FixedEffectModel fitted by AnovaFixedEffectModels.lfe or FixedEffectModels.reg.
    If mutiple models are provided, they should be nested and the last one is the most complex.
  • anovamodel: wrapped model objects; FullModel and NestedModels.
  • test: test statistics for goodness of fit. Only FTest is available now.

Other keyword arguments

  • When one model is provided:
    1. type specifies type of anova. Default value is 1.
  • When multiple models are provided:
    1. 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_lfe for FixedEffectModel.

nestedmodels(modeltype::Type{FixedEffectModel}, f::FormulaTerm, data; null = true, kwargs...)

Generate nested models from modeltype, formula and data. The null model will be an empty model if the keyword argument null is true (default).

anova_lfe(f::FormulaTerm, tbl, vcov::CovarianceEstimator = Vcov.simple(); 
        test::Type{<: GoodnessOfFit} = FTest, <keyword arguments>)
anova_lfe(test::Type{<: GoodnessOfFit}, f::FormulaTerm, tbl, vcov::CovarianceEstimator = Vcov.simple(); <keyword arguments>)

ANOVA for fixed-effect linear regression.

  • vcov: estimator of covariance matrix.
  • type: type of anova (1 , 2 or 3). Default value is 1.

anova_lfe generates a FixedEffectModel.

lfe(formula::FormulaTerm, df, vcov::CovarianceEstimator = Vcov.simple(); kwargs...)

A GLM-styled function to fit a fixed-effect model.