Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for Equality of Variances #204

Merged
merged 9 commits into from
Sep 3, 2020

Conversation

wildart
Copy link
Contributor

@wildart wildart commented May 23, 2020

Implemented tests for equality of variances:

  • One-way ANOVA Test
  • Levene's Test
  • Brown-Forsythe Test
  • Fligner-Killeen Test

@wildart
Copy link
Contributor Author

wildart commented May 24, 2020

Ready for review.

@ararslan ararslan requested a review from mschauer May 24, 2020 04:40
@mschauer
Copy link
Member

It looks like Levene's test is just a form of one-way ANOVA with F-distributed test statistic. Is this somehow already covered elsewhere?

@wildart
Copy link
Contributor Author

wildart commented May 24, 2020

Indeed, it is a variant of ANOVA.

Question is why there is no simple 1-way extendable ANOVA in this package that would allow to perform above tests?

I've seen this discourse thread ANOVA Tests in Julia?. I could try to spin this PR in a proper ANOVA interface.

@mschauer
Copy link
Member

This looks like the right approach to me. Should the Levene, Brown-Forsythe, Fligner-Killeen return an ANOVA object or have their own objects inheriting from that?

@wildart
Copy link
Contributor Author

wildart commented May 26, 2020

I do not think it is necessary to create separate types for each test. I designed VarianceEqualityTest with enough flexibility to cover the above test, and any future implementations that fit the particular profile.

@nalimilan
Copy link
Member

Do these tests have any relation with the equality of variance tests we already support?

```

Example:
Copy link
Member

Choose a reason for hiding this comment

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

We don't show examples for other tests AFAIK. Can't you put it in the docstring instead?

length(t.description[3]) != 0 ? t.description[3] : (TD <: FDist ? "F" : "χ²")

StatsBase.nobs(t::VarianceEqualityTest) = t.Nᵢ
StatsBase.dof(t::VarianceEqualityTest{Chisq}) where T = t.DFt
Copy link
Member

Choose a reason for hiding this comment

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

T doesn't exist. Is this method actually covered by tests?

StatsBase.dof(t::VarianceEqualityTest{FDist}) where T = (t.DFt, t.DFe)

teststatistic(t::VarianceEqualityTest{FDist}) = (t.DFe/t.DFt)*sum(t.SStᵢ)/sum(t.SSeᵢ)
teststatistic(t::VarianceEqualityTest{Chisq}) = let y=sum(t.SStᵢ)/sum(t.SSeᵢ); y*(t.DFe+t.DFt)/(1 + y) end # sum(t.SStᵢ)/t.s²
Copy link
Member

Choose a reason for hiding this comment

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

Use the long function form?

@katdeane
Copy link

@mschauer, are there any updates on this? This is an ideal solution for a use-case that I'm currently running and I was wondering if there's a timeline on merging it. Thanks!

@wildart
Copy link
Contributor Author

wildart commented Aug 13, 2020

I'll try to find some time next week to finish it.

@wildart
Copy link
Contributor Author

wildart commented Aug 28, 2020

Do these tests have any relation with the equality of variance tests we already support?

They are related, https://en.wikipedia.org/wiki/F-test_of_equality_of_variances#Properties, but computationally more to the ANOVA.

@nalimilan
Copy link
Member

OK (the point of my question was to know whether they should use a common type).

Can you wrap all lines at 92 chars? Otherwise, looks good to me.

@mschauer mschauer merged commit aef116c into JuliaStats:master Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants