Closed IndrajeetPatil closed 3 years ago
I think this is something for @mattansb. For Bayesian models, model_parameters()
is not much more than a wrapper around bayestestR::describe_posterior()
+ bayestestR::diagnostic_posterior()
.
I can do most of these, I think:
ttestBF()
:
Difference
: the raw difference between the correlationBF()
:
rho
: linear correlation estimate (eqivilant to pearsons r)contingencyTableBF
:
proportionBF()
:
lmBF()
/ generalTestBF()
/ regressionBF()
/ anovaBF()
mu
: mean-centered intercept? I thinksig2
: model's sigmag
/ g_*
: these are the g parameters. See ANOVA BF paper.Where should these definitions go? insight
? parameters
?
@mattansb Maybe this is confusion on my part, but is this expected?
# data
set.seed(123)
df <- dplyr::filter(.data = gapminder::gapminder, continent == "Africa")
# one-sample t-test
mod <- BayesFactor::ttestBF(x = df$gdpPercap, mu = 10000)
#> t is large; approximation invoked.
# median value
median(df$gdpPercap)
#> [1] 1192.138
# raw difference
10000 - median(df$gdpPercap)
#> [1] 8807.862
# extracting details
parameters::model_parameters(mod)
#> Parameter | Median | 89% CI | pd | % in ROPE | Prior | Effects | Component | BF
#> -------------------------------------------------------------------------------------------------------------------------
#> Difference | 8.01e+06 | [ 7.32e+06, 8.78e+06] | 100% | 0% | Cauchy (0 +- 0.71) | fixed | conditional | > 1000
If the parameter
here is the raw difference, I was expecting the estimate to be around ~ 8800, but it is actually 8010000.
No, this is a gross little bug - fixed!
set.seed(123)
x <- rnorm(100)
mod <- BayesFactor::ttestBF(x = x, mu = 10)
#> t is large; approximation invoked.
# raw difference
10 - median(x)
#> [1] 9.938244
# extracting details
parameters::model_parameters(mod, test = NULL)
#> Parameter | Median | 89% CI | Prior | Effects | Component | BF
#> -----------------------------------------------------------------------------------------
#> Difference | 9.91 | [9.78, 10.06] | Cauchy (0 +- 0.71) | fixed | conditional | > 1000
Created on 2020-09-23 by the reprex package (v0.3.0)
Thanks for fixing this so quickly!
@strengejacke Do you think there will be a new release of insight
any time soon?
This bug fix is definitely going to lead to some failing tests in my packages and I would like to coordinate my releases accordingly.
easystats::on_CRAN()
#> insight 0.4 weeks
And just ~1 week before that update, there was the previous submission, so actually the next release is no planned before end of October.
Although most of the outputs from
model_parameters
forBayesFactor
objects are clear, sometimes it's hard to figure out what some terms correspond to. And the documentation for this function doesn't have any information about this.For example- the first four rows here correspond to model-average posterior summary
and agree with columns from
JASP
:But, as a user, I may not know that
mu
corresponds to intercept and don't know what dosig2
andg_Species
here refer to.