Skip to contents

Mixed-effects discounting (TMB)

Fit SLT-beta mixed-effects discounting models to bounded indifference-point data using TMB, and simulate from the same model.

fit_dd_tmb()
Fit an indifference-point mixed-effects discounting model via TMB
simulate_dd_ip()
Simulate IP-family mixed-effects discounting data
VarCorr(<beezdiscounting_tmb>)
Random-effect covariance for a TMB discounting model

Choice-based discounting (TMB)

Fit the structural or descriptive (Young 2018) SS-vs-LL choice model — a binomial GLMM — and simulate from either model. The descriptive mode adds a VarCorr method for the random-effect covariance.

fit_dd_choice()
Fit a trial-level SS-vs-LL choice model (binomial GLMM) via TMB
simulate_dd_choice()
Simulate trial-level SS-vs-LL choice data
VarCorr(<beezdiscounting_choice>)
Random-effect (co)variances for a beezdiscounting_choice fit

Bayesian discounting (brms)

Bayesian mixed-effects discounting via brms/Stan: the indifference-point and structural-choice fitters with their default priors.

fit_dd_brms()
Fit a Bayesian Mixed-Effects Discounting Model via brms
fit_dd_choice_brms()
Fit a Bayesian Structural Choice Discounting Model via brms
default_dd_priors()
Default priors for Bayesian (brms) delay-discounting models
default_dd_choice_priors()
Default priors for the Bayesian (brms) choice model

Estimated marginal means & comparisons

Post-hoc estimated marginal means and pairwise comparisons for fitted mixed-effects discounting models.

get_dd_param_emms()
Estimated marginal means of the discount rate k
get_dd_comparisons()
Factor-level comparisons of the discount rate k

Model inspection (S3 methods)

S3 methods for extracting information from fitted models.

tidy(<beezdiscounting_brms>)
Tidy a beezdiscounting_brms model
tidy(<beezdiscounting_choice>)
Tidy a beezdiscounting_choice model into a coefficient tibble
tidy(<beezdiscounting_choice_brms>)
Tidy a beezdiscounting_choice_brms model
tidy(<beezdiscounting_comparison>)
Tidy a discounting comparison into a flat contrasts frame
tidy(<beezdiscounting_tmb>)
Tidy a beezdiscounting_tmb model into a coefficient tibble
glance(<beezdiscounting_brms>)
Glance at a beezdiscounting_brms model
glance(<beezdiscounting_choice>)
Glance at a beezdiscounting_choice model
glance(<beezdiscounting_choice_brms>)
Glance at a beezdiscounting_choice_brms model
glance(<beezdiscounting_tmb>)
Glance at a beezdiscounting_tmb model
augment(<beezdiscounting_choice>)
Augment a beezdiscounting_choice model
augment(<beezdiscounting_tmb>)
Augment a beezdiscounting_tmb model
predict(<beezdiscounting_brms>)
Predict from a beezdiscounting_brms model
predict(<beezdiscounting_choice>)
Predict from a structural choice discounting model
predict(<beezdiscounting_choice_brms>)
Predict P(LL) from a beezdiscounting_choice_brms model
predict(<beezdiscounting_tmb>)
Predict from a TMB mixed-effects discounting model
confint(<beezdiscounting_brms>)
Credible intervals for a beezdiscounting_brms model
confint(<beezdiscounting_choice>)
Confidence intervals for a structural choice discounting model
confint(<beezdiscounting_choice_brms>)
Credible intervals for a beezdiscounting_choice_brms model
confint(<beezdiscounting_tmb>)
Confidence intervals for a TMB discounting model
summary(<beezdiscounting_brms>)
Summarize a beezdiscounting_brms model
summary(<beezdiscounting_choice>)
Summarize a structural choice discounting fit
summary(<beezdiscounting_choice_brms>)
Summarize a beezdiscounting_choice_brms model
summary(<beezdiscounting_tmb>)
Summarize a TMB mixed-effects discounting fit
coef(<beezdiscounting_choice>)
Extract coefficients from a structural choice model
coef(<beezdiscounting_tmb>)
Extract coefficients from a TMB discounting model
fixef(<beezdiscounting_choice>)
Extract fixed effects from a structural choice model
fixef(<beezdiscounting_tmb>)
Extract fixed effects from a TMB discounting model
ranef(<beezdiscounting_choice>)
Extract subject-level random effects from a choice model
ranef(<beezdiscounting_tmb>)
Extract subject-level random effects from a TMB discounting model
fitted(<beezdiscounting_choice>)
Fitted values for a beezdiscounting_choice fit
fitted(<beezdiscounting_tmb>)
Fitted values for a beezdiscounting_tmb fit
residuals(<beezdiscounting_choice>)
Residuals for a beezdiscounting_choice fit
residuals(<beezdiscounting_tmb>)
Residuals for a beezdiscounting_tmb fit
print(<beezdiscounting_choice>)
Print a structural choice discounting fit
print(<beezdiscounting_tmb>)
Print a TMB mixed-effects discounting fit
print(<summary.beezdiscounting_choice>)
Print a structural choice discounting model summary
print(<summary.beezdiscounting_tmb>)
Print a TMB discounting model summary

Delay discounting (NLS / scoring)

Fit hyperbolic/exponential discount functions via nonlinear regression and score delay-discounting tasks.

fit_dd()
Fit Delay-Discounting Model
results_dd()
Extract Results from Delay-Discounting Model
plot_dd()
Plot Delay-Discounting Model
calc_dd()
Calculate scores, answers, and timing for 5.5 trial delay discounting from Qualtrics template
score_dd()
Score 5.5 trial delay discounting from Qualtrics template
ans_dd()
Converts answers from 5.5 trial delay discounting from Qualtrics template
timing_dd()
Extract timing metrics from 5.5 trial delay discounting from Qualtrics template

Probability discounting

Scoring functions for probability-discounting tasks.

calc_pd()
Calculate scores, answers, and timing for 5.5 trial probability discounting from Qualtrics template
score_pd()
Score 5.5 trial probability discounting from Qualtrics template
ans_pd()
Converts answers from 5.5 trial probability discounting from Qualtrics template
timing_pd()
Extract timing metrics from 5.5 trial probability discounting from Qualtrics template

Monetary Choice Questionnaire (MCQ, 27- and 21-item)

Scoring, lookup, simulation, and reshaping for the 27-item (Kirby, Petry, & Bickel, 1999) and 21-item (Kirby & Marakovic, 1996) MCQ.

score_mcq()
Score an MCQ (27- or 21-item)
score_mcq27()
Score 27-item MCQ
summarize_mcq()
Provide a summary of the results from the MCQ output table.
prop_ss()
Calculate proportion of SIR/SS responses at each k value
get_lookup_table()
Get internal lookup table for the 27- or 21-item MCQ
mcq_to_choice()
Convert 27- or 21-item MCQ responses to a trial-level choice frame
mcq27_to_choice()
Convert 27-item MCQ responses to a trial-level choice frame
generate_data_mcq()
Generate fake MCQ data
wide_to_long_mcq()
Reshape MCQ data wide to long
long_to_wide_mcq()
Reshape MCQ data long to wide
wide_to_long_mcq_excel()
Reshape MCQ data from wide (as used in the 21- and 27-Item Monetary Choice Questionnaire Automated Scorer) to long
long_to_wide_mcq_excel()
Reshape MCQ data from long to wide (as used in the 21- and 27-Item Monetary Choice Questionnaire Automated Scorer)

Utilities & metrics

Area under the curve, fit metrics, and systematicity checks.

calc_aucs()
Calculate Area-Under-the-Curve (AUC) Metrics for Delay Discounting Data
calc_r2()
Calculate R-Squared for a Model
calc_conf_int()
Calculate Confidence Intervals for a Parameter
check_unsystematic()
Check for Unsystematic Data Violations

Visualization

Plot methods for fitted discounting models – discount curves, Bayesian posterior bands, group-comparison forest plots, and random-effect QQ diagnostics – plus plotting for scored task outputs.

plot(<beezdiscounting_brms>)
Plot a Bayesian (brms) indifference-point discounting model
plot(<beezdiscounting_choice>)
Plot a choice-based discounting model
plot(<beezdiscounting_choice_brms>)
Plot a Bayesian (brms) choice-based discounting model
plot(<beezdiscounting_comparison>)
Plot group differences in discount rate
plot(<beezdiscounting_tmb>)
Plot a mixed-effects discounting model
plot(<prop_ss_output>)
Plot Proportion of SIR/SS Choices by k Value
plot(<score_mcq27_output>)
Plot MCQ-27 Scores
plot(<score_mcq_output>)
Plot MCQ Scores
plot_dd()
Plot Delay-Discounting Model
plot_qq(<beezdiscounting_tmb>) plot_qq(<beezdiscounting_choice>)
Random-effect normal QQ plots for discounting models

Datasets

Built-in datasets for examples and testing.

dd_ip
Delay Discounting Data
mcq27
Example 27-item MCQ data
mcq21
Example 21-item MCQ data
five.fivetrial_dd
Example Qualtrics output from the 5.5 trial delay discounting template.
five.fivetrial_pd
Example Qualtrics output from the 5.5 trial probability discounting template.

Reexports

Generics re-exported from other packages.

reexports augment tidy glance fixef ranef plot_qq
Objects exported from other packages
`%>%`
Pipe operator