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

Analysis of variance.

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

Arguments

  • glmmodels: model objects
    1. TableRegressionModel{<: LinearModel} fitted by GLM.lm
    2. TableRegressionModel{<: GeneralizedLinearModel} fitted by GLM.glm
    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. Available tests are LikelihoodRatioTest (LRT) and FTest. The default is based on the model type.
    1. TableRegressionModel{<: LinearModel}: FTest.
    2. TableRegressionModel{<: GeneralizedLinearModel}: based on distribution function, see canonicalgoodnessoffit.

Other keyword arguments

  • When one model is provided:
    1. type specifies type of anova (1, 2 or 3). 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.
Note

For fitting new models and conducting anova at the same time, see anova_lm for LinearModel, anova_glm for GeneralizedLinearModel.

AnovaBase.nestedmodelsMethod
nestedmodels(trm::TableRegressionModel{<: LinearModel}; null::Bool = true, <keyword arguments>)
nestedmodels(trm::TableRegressionModel{<: GeneralizedLinearModel}; null::Bool = true, <keyword arguments>)

nestedmodels(::Type{LinearModel}, formula, data; null::Bool = true, <keyword arguments>)
nestedmodels(::Type{GeneralizedLinearModel}, formula, data, distr::UnivariateDistribution, link::Link = canonicallink(d); null::Bool = true, <keyword arguments>)

Generate nested nested models NestedModels from a model or formula and data.

The null model will be a model with at least one factor (including intercept) if the link function does not allow factors to be 0 (factors in denominators) or the keyword argument null is false (default value is true).

  • InverseLink for Gamma
  • InverseSquareLink for InverseGaussian
  • LinearModel fitted with CholeskyPivoted when dropcollinear = true

Otherwise, it will be an empty model.

AnovaGLM.anova_glmFunction
anova_glm(X, y, d::UnivariateDistribution, l::Link = canonicallink(d); 
        test::Type{<: GoodnessOfFit} = canonicalgoodnessoffit(d), <keyword arguments>)

anova_glm(test::Type{<: GoodnessOfFit}, X, y, d::UnivariateDistribution, l::Link = canonicallink(d); <keyword arguments>)

anova(test::Type{<: GoodnessOfFit}, X, y, d::UnivariateDistribution, l::Link = canonicallink(d); <keyword arguments>)

ANOVA for genaralized linear models.

Arguments

  • X and y can be a Matrix and a Vector or a Formula and a Tables.jl compatible data.
  • d: a GLM.UnivariateDistribution.
  • l: a GLM.Link
  • test: test statistics for goodness of fit based on distribution function. See canonicalgoodnessoffit.

For other keyword arguments, see fit.

AnovaGLM.anova_lmMethod
anova_lm(X, y; test::Type{<: GoodnessOfFit} = FTest, <keyword arguments>) 

anova_lm(test::Type{<: GoodnessOfFit}, X, y; <keyword arguments>)

anova(test::Type{<: GoodnessOfFit}, ::Type{LinearModel}, X, y; 
    type::Int = 1, 
    <keyword arguments>)

ANOVA for simple linear regression.

Arguments

  • X and y can be a Matrix and a Vector or a Formula and a Tables.jl compatible data.
  • test: test statistics for goodness of fit.

Keyword arguments

  • test: test statistics for goodness of fit.
  • type specifies type of anova (1, 2 or 3). Default value is 1.
  • dropcollinear controls whether or not lm accepts a model matrix which is less-than-full rank. If true (the default), only the first of each set of linearly-dependent columns is used. The coefficient for redundant linearly dependent columns is 0.0 and all associated statistics are set to NaN.

anova_lm generate a TableRegressionModel object, which is fitted by lm.