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

report_effectsize with chi2 object: Error in abs(r): non-numeric argument to mathematical function #309

Closed
2 tasks done
rempsyc opened this issue Dec 16, 2022 · 4 comments · Fixed by #393
Closed
2 tasks done
Labels
bug 🐛 Something isn't working

Comments

@rempsyc
Copy link
Sponsor Member

rempsyc commented Dec 16, 2022

It seems that chi2 htest objects should be supported by report_effectsize through .report_effectsize_chi2. However, that does not seem to be working as expected.

library(effectsize)
library(report)
packageVersion("report")
#> [1] '0.5.5.3'
M <- as.table(rbind(c(762, 327, 468), c(484, 239, 477)))
dimnames(M) <- list(gender = c("F", "M"), party = c("Democrat","Independent", "Republican"))
(x <- chisq.test(M)) 
#> 
#>  Pearson's Chi-squared test
#> 
#> data:  M
#> X-squared = 30.07, df = 2, p-value = 2.954e-07
effectsize(x)
#> Cramer's V (adj.) |       95% CI
#> --------------------------------
#> 0.10              | [0.07, 1.00]
#> 
#> - One-sided CIs: upper bound fixed at [1.00].
report_effectsize(x)
#> Error in abs(r): non-numeric argument to mathematical function

Created on 2022-12-16 with reprex v2.0.2

  • chisq.test
  • friedman.test
@rempsyc
Copy link
Sponsor Member Author

rempsyc commented Dec 16, 2022

Similar idea with friedman.test:

library(report)
library(effectsize)
packageVersion("report")
#> [1] '0.5.5.3'

wb <- aggregate(warpbreaks$breaks,
                by = list(w = warpbreaks$wool,
                          t = warpbreaks$tension),
                FUN = mean)
wb
#>   w t        x
#> 1 A L 44.55556
#> 2 B L 28.22222
#> 3 A M 24.00000
#> 4 B M 28.77778
#> 5 A H 24.55556
#> 6 B H 18.77778
x <- friedman.test(wb$x, wb$w, wb$t)
effectsize(x)
#> Kendall's W |       95% CI
#> --------------------------
#> 0.11        | [0.11, 1.00]
#> 
#> - One-sided CIs: upper bound fixed at [1.00].

report_table(x)
#> Error in abs(r): non-numeric argument to mathematical function

Created on 2022-12-16 with reprex v2.0.2

But maybe that's because there is no report_htest_friedman.R file or function.

@rempsyc

This comment was marked as outdated.

@DominiqueMakowski
Copy link
Member

isn't it related to the addition of CIs in effectsize()?

IndrajeetPatil added a commit that referenced this issue Jan 10, 2023
* report_sample: add effective n (closes #306)

* Addresses #309 part 1: add type and rules to chi2 objects

* Add tests + styler

* remove duplicate author in DESCRIPTION

* Harmonize snapshot testing with OS platform variant.

* styler

* Run tests only on Windows

closes #312

* Use devel effectsize

* run only once a week [skip ci]

* Rerun snapshot tests on Windows with latest version of effectsize

* change snapshots variant = .Platform$OS.type to 'windows', styler, lints

Co-authored-by: Indrajeet Patil <patilindrajeet.science@gmail.com>
@rempsyc rempsyc added the bug 🐛 Something isn't working label Jan 18, 2023
@strengejacke
Copy link
Member

In report_effectsize.htest() we need to add if-statements for the above mentioned failing htests (Chi2 works meanwhile) and add methods for those (like in report_htest_wilcox.R).

rempsyc added a commit that referenced this issue Aug 27, 2023
rempsyc added a commit that referenced this issue Sep 23, 2023
* addresses #309 part 2 (friedman test)

* styler, lints, fix test with super-assignment

* fix friedman text, new lints

* NEWS [skip ci]

* trigger checks

* delete snapshot and restart from scratch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants