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

BF_inclusion sensitive to order of terms in an interaction #223

Closed
mattansb opened this issue Sep 10, 2019 · 1 comment
Closed

BF_inclusion sensitive to order of terms in an interaction #223

mattansb opened this issue Sep 10, 2019 · 1 comment

Comments

@mattansb
Copy link
Member

In the example below, shape:color and color:shape should be one term (same for color:shape:ID and shape:color:ID):

library(bayestestR)
library(lme4)


data("puzzles", package = "BayesFactor")
puzzles <- as.data.frame(lapply(puzzles, function(x) rep(x,5)))
puzzles$RT <- puzzles$RT + rnorm(240)

m1 <- lmer(RT ~ shape + shape:color + (shape + shape:color|ID), puzzles)
m2 <- lmer(RT ~ color + shape:color + (color + shape:color|ID), puzzles)
m3 <- lmer(RT ~ color:shape + (color:shape|ID), puzzles)

x <- bayesfactor_models(m1,m2,m3)
bayesfactor_inclusion(x)
#> # Inclusion Bayes Factors (Model Averaged)
#> 
#>                Pr(prior) Pr(posterior) Inclusion BF
#> shape               0.33           0.5            2
#> shape:color         0.33           0.5            2
#> 1:ID                1.00           1.0          NaN
#> shape:ID            0.33           0.5            2
#> shape:color:ID      0.33           0.5            2
#> color               0.33           0.5            2
#> color:shape         0.67           0.5          0.5
#> color:ID            0.33           0.5            2
#> color:shape:ID      0.67           0.5          0.5
#> 
#> * Compared among: all models
#> *    Priors odds: uniform-equal

Created on 2019-09-10 by the reprex package (v0.3.0)

mattansb added a commit that referenced this issue Sep 10, 2019
@mattansb
Copy link
Member Author

Fixed

library(bayestestR)
library(lme4)

data("puzzles", package = "BayesFactor")
puzzles <- as.data.frame(lapply(puzzles, function(x) rep(x,5)))
puzzles$RT <- puzzles$RT + rnorm(240)

m1 <- lmer(RT ~ shape + shape:color + (shape + shape:color|ID), puzzles)
m2 <- lmer(RT ~ color + shape:color + (color + shape:color|ID), puzzles)
m3 <- lmer(RT ~ color:shape + (color:shape|ID), puzzles)

x <- bayesfactor_models(m1,m2,m3)
bayesfactor_inclusion(x)
#> # Inclusion Bayes Factors (Model Averaged)
#> 
#>                Pr(prior) Pr(posterior) Inclusion BF
#> shape               0.33           0.5            2
#> color:shape         1.00           1.0          NaN
#> 1:ID                1.00           1.0          NaN
#> shape:ID            0.33           0.5            2
#> color:shape:ID      1.00           1.0          NaN
#> color               0.33           0.5            2
#> color:ID            0.33           0.5            2
#> 
#> * Compared among: all models
#> *    Priors odds: uniform-equal

Created on 2019-09-10 by the reprex package (v0.3.0)

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

No branches or pull requests

1 participant