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

Avoid negative differences in ftest #576

Open
andreasnoack opened this issue Nov 20, 2024 · 0 comments
Open

Avoid negative differences in ftest #576

andreasnoack opened this issue Nov 20, 2024 · 0 comments
Assignees
Milestone

Comments

@andreasnoack
Copy link
Member

Now that we are preparing for 2.0 anyway then I think we should change ftest to avoid the negative differences. They trigger me. They can only meaningfully have one sign so lets define them to always be positive. Maybe we'd like to enforce that the ordering of models follows a nesting structure at the same time.

julia> ftA = lm(@formula(y ~ x), df);

julia> df = DataFrame(x = randn(10), y = randn(10));

julia> ftA = lm(@formula(y ~ x), df);

julia> ft0 = lm(@formula(y ~ 1), df);

julia> ftest(ft0, ftA)
F-test: 2 models fitted on 10 observations
───────────────────────────────────────────────────────────────
     DOF  ΔDOF     SSR     ΔSSR      R²     ΔR²      F*   p(>F)
───────────────────────────────────────────────────────────────
[1]    2        8.1647           0.0000
[2]    3     1  6.1289  -2.0358  0.2493  0.2493  2.6573  0.1417
───────────────────────────────────────────────────────────────

julia> ftest(ftA, ft0)
F-test: 2 models fitted on 10 observations
───────────────────────────────────────────────────────────────
     DOF  ΔDOF     SSR    ΔSSR      R²      ΔR²      F*   p(>F)
───────────────────────────────────────────────────────────────
[1]    3        6.1289          0.2493
[2]    2    -1  8.1647  2.0358  0.0000  -0.2493  2.6573  0.1417
───────────────────────────────────────────────────────────────
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant