Skip to content

Commit

Permalink
Merge pull request #7 from yufongpeng/release-0.2.1
Browse files Browse the repository at this point in the history
Release 0.2.1
  • Loading branch information
yufongpeng committed Mar 17, 2023
2 parents 63c2161 + ad2404f commit f44e7cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AnovaFixedEffectModels"
uuid = "e4965305-65d6-464d-9c03-ae3e5cffadab"
authors = ["yufongpeng <54415349+yufongpeng@users.noreply.github.com> and contributors"]
version = "0.2.0"
version = "0.2.1"

[deps]
AnovaBase = "946dddda-6a23-4b48-8e70-8e60d9b8d680"
Expand Down
14 changes: 13 additions & 1 deletion src/anova.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
# Main API
"""
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`](@ref) for details.
# Arguments
* `lfemodels`: model objects
1. `FixedEffectModel` fitted by `AnovaFixedEffectModels.lfe` or `FixedEffectModels.reg`.
* `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
Expand All @@ -30,6 +33,15 @@ anova(models::Vararg{M};
kwargs...) where {M <: FixedEffectModel} =
anova(test, models...; kwargs...)

anova(aovm::NestedModels{M};
test::Type{<: GoodnessOfFit} = FTest,
kwargs...) where {M <: FixedEffectModel} =
anova(test, aovm; kwargs...)

anova(aovm::FullModel{M};
test::Type{<: GoodnessOfFit} = FTest,
kwargs...) where {M <: FixedEffectModel} =
anova(test, aovm; kwargs...)
# ================================================================================================
# ANOVA by F test
anova(::Type{FTest},
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ isapprox(x::NTuple{N, Float64}, y::NTuple{N, Float64}, atol::NTuple{N, Float64}
lm1 = lm(@formula(gpa ~ student & occasion + job), gpa)
fem2 = lfe(@formula(gpa ~ fe(student) & occasion + 0 + job), gpa)
lm2 = lm(@formula(gpa ~ student & occasion + 0 + job), gpa)
global aovf1 = AFE.anova(fem1)
global aovf1 = AFE.anova(FullModel(fem1, 1, true, true))
global aovl1 = AnovaGLM.anova(lm1)
global aovf2 = AFE.anova(fem2, type = 3)
global aovl2 = AnovaGLM.anova(lm2, type = 3)
global aovfs = AFE.anova(fem0, fem1)
global aovfs = AFE.anova(NestedModels{FixedEffectModel}(fem0, fem1))
global aovls = AnovaGLM.anova(lm0, lm1)
@test !(@test_error test_show(aovf1))
@test !(@test_error test_show(aovf2))
Expand Down

2 comments on commit f44e7cb

@yufongpeng
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/79778

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" f44e7cbfaefa413080fe0e4d49f2a814b8c9626c
git push origin v0.2.1

Please sign in to comment.