shinybeez: A Shiny app for Behavioral Economic (be) Easy (ez) Demand and Discounting.
If you use any part of shinybeez in your work, please cite it:
Kaplan, B. A. & Reed, D. D. (2025). shinybeez: A Shiny app for Behavioral
Economic Easy Demand and Discounting. Journal of the Experimental Analysis of
Behavior, 123(2), 335-376. doi: 10.1002/jeab.70000
Hear about this paper on a "Deep Dive" podcast on my website codedbx.com
To install shinybeez locally and run it on your own machine, you must first install Docker.
-
To start the app via the Docker Desktop program, first click Docker Hub on the left side and search for shinybeez.
-
Click on the tile and then click "Pull" to download the image.
-
Go to "Images" on the left hand side and click the newly downloaded image. Click the ▶ icon under "Actions" to start the app and bring up the options menu.
-
Expand the optional settings clicking the ▼. Enter in '3838' in the "Host port" box. Then click "Run".
-
Open up your browser of choice and navigate to http://localhost:3838. shinybeez should now be running locally on your machine.
Alternatively, after you have installed Docker on your computer you can run the following commands in your terminal to start the app:
docker pull brentkaplan/shinybeez:latest
docker run -p 3838:3838 brentkaplan/shinybeez:latest
Then, navigate to http://localhost:3838 in your browser of choice.
This Github repsitory contains the code required to run the app locally. To run the app locally,
-
Clone the repository (either
git clone https://github.com/brentkaplan/shinybeez.git
or download the zip file) -
Open new R session in the downloaded folder
-
Install the
renv
package usinginstall.packages("renv")
-
Install all required packages using
renv::install()
-
Run
shiny::runApp()
If you find issues, questions, or feedback, or would like to contribute, please submit an issue or a pull request, or email me.
shinybeez is an R Shiny app that allows analyses and visualizations of
behavioral economic demand and discounting data. It relies on the
beezdemand
and beezdiscounting
R packages. In addition to a comprehensive user guide, template files,
and dark mode toggle, shinybeez includes the following features:
-
Exportable descriptive table of demand data (mean, median, sd, proportion of zeros, etc.)
-
Exportable empirical measures of demand data (Intensity, BP0, BP1, Omax, Pmax)
-
Exportable table of systematic response sets (customizable bounce, trend, reversals from zero criteria)
-
Exportable table of regression results (Q0,
$\alpha$ , R2, derived and exact Omax, Pmax) -
Exportable plot in APA format of demand data and best-fit lines (customizable plot title, axis title text, pseudo-log axes) in png, pdf, svg, and more
-
Option to calculate descriptive and regression results by a grouping variable
-
Choose between the exponential model of demand or the exponentiated model of demand
-
Select various k values (1-4, individual k, fitted k, empirical range of data)
-
Choose between Fit to Group (pooled), Fit to Group (mean), and Two Stage
-
Choose between scoring the 27-Item Monetary Choice Questionnaire (MCQ), regression for delay discounting indifference points, the 5-trial minute task for delay discounting, and the 5-trial minute task for probability discounting
-
Score the 27-Item MCQ identically to that of the 27-Item MCQ Automated Scorer in Microsoft Excel
-
Choose various methods to impute missing data for the 27-Item MCQ
-
Choose between no transformation, log10, transformation, and natural log transformation
-
Exportable table of MCQ results (overall, small, medium, large, and geomean (i.e., composite) k values; overall, small, medium, large, and composite consistency; overall, small, medium, and large proportion of LDR/LL chosen; and the imputation method)
-
Exportable table of summary statistics (mean, sd, sem)
-
Exportable table of correlations between small, medium, and large magnitudes
-
Exportable table of imputed data when imputing missing data
-
Exportable plot in APA format of proportion of SIR/SS choices by k value rank
-
Exportable plot in APA format of box plot of k values
-
Exportable table of systematic response sets according to Johnson & Bickel's (2008) systematic criteria (thresholds can be customized)
-
Choose between Fit to Group (pooled), Fit to Group (mean), and Two Stage
-
Choose between Mazur's (1987) hyperbolic model or a simple exponential model
-
Exportable table of regression results (including k, R2, and Area Under the Curve)
-
Regression results contain standard AUC, log10 AUC, and ordinal AUC
-
Exportable plot in APA format of discounting data and best-fit lines (customizable plot title, axis title text, log x-axis) in png, pdf, svg, and more
If you would like to test the functionality of shinybeez, you can download some of the example files included in this Github repository:
-
27-Item Monetary Choice Questionnaire with 100 response sets with missing data
-
Delay Discounting indifference point data with 100 response sets
-
5.5 Trial Probability Discounting from the Qualtrics template
Several template files are included in this Github repository:
-
Demand template file in long format (including grouping variable)
-
Demand template file in wide format (including grouping variable)
-
27-Item Monetary Choice Questionnaire template in long format
-
27-Item Monetary Choice Questionnaire template in wide format
In addition to using shinybeez, we recommend citing the following papers depending on what features of shinybeez you use:
Underyling R package driving demand functions:
Kaplan, B. A., Gilroy, S. P., Reed, D. D., Koffarnus, M. N., &
Hursh, S. R. (2019). The R package beezdemand: Behavioral Economic
Easy Demand. Perspectives on Behavior Science,
42(1), 163-180.
https://doi.org/10.1007/s40614-018-00187-7
Systematic criteria:
Stein, J. S., Koffarnus, M. N., Snider, S. E., Quisenberry, A. J., & Bickel, W. K. (2015). Identification and management of nonsystematic purchase task data: Toward best practice. Experimental and Clinical Psychopharmacology, 23(5), 377-386. https://doi.org/10.1037/pha0000020
Exponentiated demand equation:
Koffarnus, M. N., Franck, C. T., Stein, J. S., & Bickel, W. K. (2015). A modified exponential behavioral economic demand model to better describe consumption data. Experimental and Clinical Psychopharmacology, 23(6), 504-512. https://doi.org/10.1037/pha0000045
Exponential demand equation:
Hursh, S. R., & Silberberg, A. (2008). Economic demand and essential value. Psychological Review, 115(1), 186-198. https://doi.org/10.1037/0033-295X.115.1.186
Underyling R package driving discounting functions:
Kaplan, B. A. (2023). beezdiscounting: Behavioral Economic Easy Discounting. R package version 0.3.2, https://CRAN.R-project.org/package=beezdiscounting
Describing scoring of the 21- and 27-Item Monetary Choice Questionnaires:
Kaplan, B. A., Amlung, M., Reed, D. D., Jarmolowicz, D. P.,
McKerchar, T. L., & Lemley, S. M. (2016). Automating scoring of
delay discounting for the 21- and 27-Item Monetary Choice
Questionnaires. The Behavior Analyst, 39(2),
293-304.
https://doi.org/10.1007/s40614-016-0070-9
Seminal article introducing the 27-Item Monetary Choice Questionnaire:
Kirby, K. N., Petry, N. M., & Bickel, W. K. (1999). Heroin addicts have higher discount rates for delayed rewards than non-drug-using controls. Journal of Experimental Psychology: General, 128(1), 78-87. https://doi.org/10.1037//0096-3445.128.1.78
Imputing missing data in the 27-Item Monetary Choice Questionnaire:
Yeh, Y.-H., Tegge, A. N., Freitas-Lemos, R., Myerson, J., Green, L., & Bickel, W. K. (2023). Discounting of delayed rewards: Missing data imputation for the 21- and 27-item monetary choice questionnaires. PLOS ONE, 18(10), e0292258. https://doi.org/10.1371/journal.pone.0292258
Systematic criteria:
Johnson, M. W., & Bickel, W. K. (2008). An algorithm for identifying nonsystematic delay-discounting data. Experimental and Clinical Psychopharmacology, 16(3), 264-274. https://doi.org/10.1037/1064-1297.16.3.264
Mazur's hyperbolic discounting model:
Mazur, J. E. (1987). An adjusting procedure for studying delayed reinforcement. In M. L. Commons, J. E. Mazur, J. A. Nevin, & H. Rachlin (Eds.), The effect of delay and of intervening events on reinforcement value (pp. 55-73). Lawrence Erlbaum Associates, Inc.
Variations on Area Under the Curve (AUC):
Borges, A. M., Kuang, J., Milhorn, H., & Yi, R. (2016). An alternative approach to calculating Area-Under-the-Curve (AUC) in delay discounting research. Journal of the Experimental Analysis of Behavior, 106, 145-155. https://doi.org/10.1002/jeab.219
Minute discounting task:
Koffarnus, M. N., & Bickel, W. K. (2014). A 5-trial adjusting delay discounting task: Accurate discount rates in less than 60 seconds. Experimental and Clinical Psychopharmacology, 22(3), 222-228. https://doi.org/10.1037/a0035973
Koffarnus, M. N., Rzeszutek, M. J., & Kaplan, B. A. (2021). Additional discounting rates in less than one minute: Task variants for probability and a wider range of delays. https://doi.org/10.13140/RG.2.2.31281.92000
Koffarnus, M. N., Kaplan, B. A., & Stein, J. S. (2017). User guide for Qualtrics minute discounting template. https://doi.org/10.13140/RG.2.2.26495.79527