Closed strengejacke closed 1 year ago
library(effectsize)
library(datawizard)
data(iris)
x <- data_filter(iris, Species != "versicolor")
x$Species <- as.character(x$Species)
x$Species[97:100] <- NA
# works, but very large difference to other approach?
t.test(x$Sepal.Length ~ x$Species, var.equal = TRUE) |> effectsize()
#> Cohen's d | 95% CI
#> --------------------------
#> -3.12 | [-3.72, -2.52]
#>
#> - Estimated using pooled SD.
t.test(Sepal.Length ~ Species, data = x, var.equal = TRUE) |> effectsize()
#> Warning: Unable to retrieve data from htest object.
#> Returning an approximate effect size using t_to_d().
#> d | 95% CI
#> ----------------------
#> -3.15 | [-3.75, -2.54]
Created on 2023-02-15 with reprex v2.0.2
Merging #564 (18c66b8) into main (22f7192) will increase coverage by
0.05%
. The diff coverage is97.50%
.:exclamation: Current head 18c66b8 differs from pull request most recent head 6c428af. Consider uploading reports for the commit 6c428af to get more accurate results
:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
@@ Coverage Diff @@
## main #564 +/- ##
==========================================
+ Coverage 91.12% 91.18% +0.05%
==========================================
Files 55 55
Lines 3336 3335 -1
==========================================
+ Hits 3040 3041 +1
+ Misses 296 294 -2
Impacted Files | Coverage Δ | |
---|---|---|
R/cohens_d.R | 96.80% <ø> (ø) |
|
R/cohens_g.R | 87.80% <ø> (ø) |
|
R/convert_between_common_language.R | 95.34% <ø> (ø) |
|
R/convert_between_odds_to_probs.R | 78.57% <ø> (ø) |
|
R/convert_stat_to_d.R | 95.45% <ø> (ø) |
|
R/convert_stat_to_r.R | 95.12% <ø> (ø) |
|
R/effectsize.BFBayesFactor.R | 91.30% <ø> (ø) |
|
R/eta_squared_posterior.R | 63.41% <ø> (ø) |
|
R/plot.R | 100.00% <ø> (ø) |
|
R/utils.R | 82.75% <ø> (ø) |
|
... and 17 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
@mattansb This PR contains some lintr-related changes and I removed all @import
tags, thus many changes are actually not related to the issue itself. The relevant change is only here:
I added tests, too. Maybe we should generally only keep complete cases, there are 1-2 further instances, where you simply omit missings per vector, which may result in unequal length of data.
Okay, missing data is better dealt with in .get_data_2_samples()
, so I completely removed the na.omit
s from the htest
functions (which are older bits of code).
Once all GHA pass, this can be merged (:
Shit... I know what's happening.
Is this urgent for something? If not, I'll fix this on Sunday...
No, not urgent. :-)
I've pushed a temp fix (until https://github.com/easystats/insight/issues/722 is resolved).
Do you have examples for all the combinations in your temp-fix?
I think these are all the methods for fitting t.tests that can recover data
# One sample
tt1 <- t.test(mtcars$mpg)
tt2 <- t.test(mtcars$mpg ~ 1)
# Two sample
tt3 <- t.test(mtcars$mpg ~ mtcars$am)
tt4 <- t.test(mtcars$mpg[mtcars$am==0], mtcars$mpg[mtcars$am==1])
# Paired
tt5 <- t.test(sleep$extra ~ sleep$group, paired = TRUE)
tt6 <- t.test(sleep$extra[sleep$group == "1"], sleep$extra[sleep$group == "2"], paired = TRUE)
tt7 <- t.test(Pair(sleep$extra[sleep$group == "1"], sleep$extra[sleep$group == "2"]) ~ 1)
Should I merge this for now?
Yes, maybe also include a test for the insight version, so the code won't break once https://github.com/easystats/insight/pull/723 is implemented?
Errors seem to be unrelated to this PR.
Fixed #563