richarddmorey / BayesFactor

BayesFactor R package for Bayesian data analysis with common statistical models.
https://richarddmorey.github.io/BayesFactor/
132 stars 49 forks source link

lmBF change reference cathegory #100

Closed SanVerhavert closed 7 years ago

SanVerhavert commented 7 years ago

It would be useful if lmBF allowed the user to change the reference category when using categorical predictors/covariates especially when combined with continuous predictors/covariates. The lmBF function converts categorical variables to dummy variables like R's builtin lm function does. The lmBF function does not automatically treat the first level as the reference level (which lm does). This causes some results to be difficult to interpret. e.g. using the puzzles data: BF <- lmBF(RT ~ shape + color + shape:color + ID, data=puzzles, whichRandom="ID") when calculating the posterior of BF estimates are given for shape-square and shape-circle. Both these estimates are against a baseline of no color. Which is not meaningfull.

richarddmorey commented 7 years ago

What do you mean it is not "meaningful"? It's just another parametrisation; see Rouder et al (2012) for the important reasons for this parametrisation.

You are free to reparametrise if you like, because it is just a linear transformation of the parameters. See here for several examples: https://cran.r-project.org/web/packages/BayesFactor/vignettes/compare_lme4.html

SanVerhavert commented 7 years ago

I completely overlooked the parametrisation. Thanks you for your answer.