Returns a design or model matrix of orthonormal contrasts such that the
marginal prior on all effects is identical. Implementation from Singmann &
the description in Rouder, Morey, Speckman, & Province (2012, p. 363).
Though using this factor coding scheme might obscure the interpretation of parameters, it is essential for correct estimation of Bayes factors for contrasts and order restrictions of multi-level factors (where
info on specifying correct priors for factors with more than 2 levels in
the Bayes factors vignette.
a vector of levels for a factor, or the number of levels.
a logical indicating whether contrasts should be computed.
logical indicating if the result should be sparse
contrasts = FALSE, the returned contrasts are equivalent to
contr.treatment(, contrasts = FALSE), as suggested by McElreath (also known
as one-hot encoding).
matrix with n rows and k columns, with k=n-1 if contrasts is
TRUE and k=n if contrasts is
McElreath, R. (2020). Statistical rethinking: A Bayesian course with examples in R and Stan. CRC press.
Rouder, J. N., Morey, R. D., Speckman, P. L., & Province, J. M. (2012). Default Bayes factors for ANOVA designs. Journal of Mathematical Psychology, 56(5), 356-374. https://doi.org/10.1016/j.jmp.2012.08.001
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.