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

glance on an aov model reports the wrong df value #212

Closed
cmartin opened this issue Mar 16, 2017 · 6 comments
Closed

glance on an aov model reports the wrong df value #212

cmartin opened this issue Mar 16, 2017 · 6 comments

Comments

@cmartin
Copy link

cmartin commented Mar 16, 2017

Unless I'm misunderstanding something, glance should report the same df as in summary (e.g. 2 in this example) but it seems to always report df+1

library(broom)

d <- data.frame(
  y = c(3,4,3.5,4.1,6,7),
  group = c("a","b","a","b","c","c")
)
m <- aov(y~group,data = d)

summary(m)
glance(m)

This is with broom 0.4.2 (the current version with tidyverse if I'm not mistaken)

@kcmacstat
Copy link

Same problem occurs with glance on an lm model, i.e., glance(lm.object). The df is computed incorrectly even though summary(lm.object) shows the correct df.

@lemna
Copy link

lemna commented Nov 13, 2017

glance() should probably return the numerator and denumerator df for the F statistic. It doesn't do that because it uses the df slot from summary.lm() (which contains the rank of the model matrix). It might be more sensible to use the df from the fstatistic slot.

@alexpghayes
Copy link
Collaborator

In #624 I've moved to the numerator degrees of freedom for the F-statistic for lm objects. Here, I'm a little less certain about what to do. In a particular ANOVA table there are potentially many F-tests of interest, all with different degrees of freedom. So far the approach has been to treat the aov like the corresponding regression, and report the statistics for the regression, but I'm not sure how I feel about this. I almost think glance.aov() should be an error instead. Thoughts @dgrtwo?

@alexpghayes
Copy link
Collaborator

Tentatively I've thrown an error.

@simonpcouch
Copy link
Collaborator

Addressed in 0.7.0. :-)

@github-actions
Copy link

github-actions bot commented Mar 7, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants