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

ftest improvements #337

Merged
merged 5 commits into from
Oct 17, 2019
Merged

ftest improvements #337

merged 5 commits into from
Oct 17, 2019

Conversation

nalimilan
Copy link
Member

Allow passing models from simpler to more complex, giving equivalent tests but with
reversed signs for ΔDOF, ΔSSR and ΔR².
Stop printing degrees of freedom, as residual DOF and difference in DOF seems enough.
Print two spaces instead of one between columns to make table more readable, and add
horizontal lines to match the CoefTable printing.
Make struct type stable by filling tuples with an initial NaN entry when needed.
Make tests cover more situations by having a model with ΔDOF of 2.
Small code improvements.

Fixes #275 (Cc: @andreasnoack)

Allow passing models from simpler to more complex, giving equivalent tests but with
reversed signs for ΔDOF, ΔSSR and ΔR².
Stop printing degrees of freedom, as residual DOF and difference in DOF seems enough.
Print two spaces instead of one between columns to make table more readable, and add
horizontal lines to match the CoefTable printing.
Make struct type stable by filling tuples with an initial NaN entry when needed.
Make tests cover more situations by having a model with ΔDOF of 2.
Small code improvements.
@nalimilan
Copy link
Member Author

Cc: @LewisHein

@codecov-io
Copy link

codecov-io commented Oct 13, 2019

Codecov Report

Merging #337 into master will increase coverage by 0.69%.
The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #337      +/-   ##
==========================================
+ Coverage   68.79%   69.49%   +0.69%     
==========================================
  Files           6        6              
  Lines         516      531      +15     
==========================================
+ Hits          355      369      +14     
- Misses        161      162       +1
Impacted Files Coverage Δ
src/ftest.jl 97.95% <96.96%> (-2.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f86dc6d...eed140b. Read the comment docs.

src/ftest.jl Outdated
Model 3 11 2 -1 3.2292 -3.1008 0.0000 0.9603 241.6234 <1e-7
julia> ftest(nullmodel.model, model.model)
──────────────────────────────────────────────────────────────────────
Res. DOF ΔDOF SSR ΔSSR R² ΔR² F* p(>F)
Copy link
Member Author

@nalimilan nalimilan Oct 13, 2019

Choose a reason for hiding this comment

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

Something to discuss is whether to print the residual degrees of freedom or the consumed degrees of freedom. Other implementations are inconsistent in that regard.

It could make more sense to print the consumed ones, as they give an indication about the complexity of the model, while the residual degrees of freedom reflect the sample size (which is common to all models). It also takes fewer characters in the heading (just "DOF"). Opinions?

@nalimilan
Copy link
Member Author

Another question is whether we should continue allowing to pass a single model. That doesn't sound terribly useful, and we could eventually do a test against the null model in that case instead (which is what ftest in the lmtest R package does).

But technically speaking, throwing an error would be breaking. Maybe just print a deprecation warning for now?

@kleinschmidt
Copy link
Member

My feeling is that passing a single model doesn't provide a useful test and if you're just doing it to get a convenient printout of the DOF, RSS, etc. statistics that's too punny. So we should deprecate that.

Copy link
Member

@kleinschmidt kleinschmidt left a comment

Choose a reason for hiding this comment

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

Looks good modulo one comment on docstring.

src/ftest.jl Outdated Show resolved Hide resolved
@compleathorseplayer
Copy link

Hi. Pardon me for being thick, but how does one easily get the fstat which is routinely printed out on all R regressions?
[i.e., for elementary students who won't initially understand the theory of '2 model comparison']

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.

Ftest printing
4 participants