With 'appRiori'
appRiori is a Shiny app, distributed as an R package, that helps you code and obtain customized planned comparisons (a priori contrasts). You upload or pick a dataset, choose the research variables, and the app guides you to the set of comparisons that best fits your hypotheses, for both main effects and interactions. It shows the contrast and hypothesis matrices and generates the R code (base R and hypr) to use the contrasts in your own models.
The package also provides contrasts_summary(), which extracts the estimates
and tests of hypr contrasts from a fitted lm, glm or lme4 model.
Install the released version from CRAN:
install.packages("appRiori")
or the development version from GitHub:
# install.packages("remotes")
remotes::install_github("Ugranziol/appRiori")
Start the app with:
library(appRiori)
appRiori()
The app opens in your browser. A tutorial with worked examples is available
inside the app. Any argument of appRiori() is passed on to
shiny::runApp(), for example appRiori(launch.browser = FALSE, port = 8080).
Once the contrasts are set with hypr, contrasts_summary() reports the
results labelled with the hypotheses:
library(hypr)
df <- MASS::anorexia
h <- hypr(~ 1/2 * CBT + 1/2 * FT - Cont, ~ CBT - FT,
levels = c("CBT", "Cont", "FT"))
contrasts(df$Treat, how.many = 2) <- cmat(h)
model <- lm(Prewt ~ Treat, data = df)
contrasts_summary(model)
If you use appRiori, please cite:
Granziol, U., Rabe, M., Gallucci, M., Spoto, A., & Vidotto, G. (2025). Not another post hoc paper: A new look at contrast analysis and planned comparisons. Advances in Methods and Practices in Psychological Science, 8(1). https://doi.org/10.1177/25152459241293110
In R, citation("appRiori") gives the reference in BibTeX format too.
Please report problems at https://github.com/Ugranziol/appRiori/issues.
GPL (>= 3)