beezdemand
0.2.0Behavioral Economic Easy Demand
Overview
Facilitates many of the analyses performed in studies of behavioral economic demand. The package supports commonly-used options for modeling operant demand including (1) data screening proposed by Stein, Koffarnus, Snider, Quisenberry, & Bickel (2015; doi:10.1037/pha0000020), (2) fitting models of demand such as linear (Hursh, Raslear, Bauman, & Black, 1989, doi:10.1007/978-94-009-2470-3_22), exponential (Hursh & Silberberg, 2008, doi:10.1037/0033-295X.115.1.186) and modified exponential (Koffarnus, Franck, Stein, & Bickel, 2015, doi:10.1037/pha0000045), and (3) calculating numerous measures relevant to applied behavioral economists (Intensity, Pmax, Omax). Also supports plotting and comparing data.
Deprecations
FitCurves()is now superseded byfit_demand_fixed().FitCurves()will continue to work but emits a soft deprecation warning. The new function provides a modern S3 interface withsummary(),tidy(),glance(),predict(), andplot()methods. Seevignette("migration-guide")for migration instructions.FitMeanCurves()is now superseded byfit_demand_fixed(agg = "Mean")orfit_demand_fixed(agg = "Pooled").
New Features
Koffarnus Equation for Mixed-Effects Models
fit_demand_mixed()now supports the Koffarnus et al. (2015) exponentiated equation viaequation_form = "koff". This enables fitting demand curves using the same equation form available inFitCurves()within the modern hierarchical mixed-effects framework. Thekparameter can be user-specified or auto-calculated from data range.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
broom Integration
- New
augment()methods for all model classes provide fitted values and residuals in a tidy tibble: augment.beezdemand_fixed(): Returns.fitted,.residaugment.beezdemand_hurdle(): Returns.fitted,.fitted_link,.fitted_prob,.resid,.resid_responseaugment.beezdemand_nlme(): Returns.fitted,.resid,.fixed
Model Comparison Framework
- New
compare_models()function for unified model comparison across all beezdemand model classes. Reports AIC, BIC, delta_AIC, delta_BIC, and performs likelihood ratio tests when models are from the same backend and nested. - New
anova()S3 methods for comparing nested models: anova.beezdemand_hurdle(): LRT for nested hurdle modelsanova.beezdemand_nlme(): Delegates to nlme::anova.lme()
Model Diagnostics Suite
- New
check_demand_model()generic with methods for all model classes. Performs comprehensive diagnostics including convergence checks, boundary condition detection, random effect variance assessment, and residual outlier detection. Returns structured diagnostics object with issues and recommendations. (Namedcheck_demand_model()to avoid conflict withperformance::check_model().) - New
plot_residuals()function creates diagnostic plots: residuals vs fitted, histogram of residuals, and Q-Q plots. Works with all model classes via theaugment()infrastructure. - New
plot_qq()function creates Q-Q plots for random effects to assess normality assumptions in hurdle and NLME models.
Normalized Alpha (Alpha Star)
- All model classes now compute
alpha_star(normalized alpha, Strategy B; Rzeszutek et al., 2025), which makes the elasticity parameter comparable across different values ofk. Available inFitCurves()output (columnsalpha_starandalpha_star_se),tidy()onbeezdemand_fixedobjects, andtidy()onbeezdemand_hurdleobjects. Standard errors are obtained via the delta method. See?param-registryfor details.
Modern Wrappers for Legacy Functions
- New
get_empirical_measures()as a modern replacement forGetEmpirical(). Returns abeezdemand_empiricalS3 object; access the results via$measures. - New
get_descriptive_summary()as a modern replacement forGetDescriptives(). Returns abeezdemand_descriptiveS3 object; access the results via$statistics. - New
get_k()as a modern replacement forGetK(). Returns a single numeric k value with optional verbose output.
Other New Features
- New
confint()methods for extracting confidence intervals from all model classes:beezdemand_fixed,beezdemand_hurdle,beezdemand_nlme, andcp_model_nls. - New migration guide vignette (
vignette("migration-guide")) documenting the transition fromFitCurves()tofit_demand_fixed().
Breaking Changes
summary()methods forbeezdemand_hurdleandbeezdemand_nlmenow return structured summary objects instead of printing directly. Useprint(summary(fit))for console output. Programmatic access is now possible:s <- summary(fit); s$coefficients.fit_demand_hurdle()now fits demand parameters in natural-log space (log_q0,log_alpha,log_k) and reports back-transformed values; theparam_spaceargument has been removed.fit_cp_nls()now uses log10-parameterized optimizer coefficients (log10_qalone,I,log10_beta) across equation forms; the"exponential"form fits on thelog10(y)response scale and filtersy <= 0with a warning.predict.cp_model_nls()now always returnsy_predon the naturalyscale; for"exponential"it additionally returnsy_pred_log10(and no longer returnsy_pred_natural).
Additional New Features
- New
fit_demand_fixed()function provides a modern interface for individual demand curve fitting. Returns a structured S3 object withsummary(),tidy(), andglance()methods. This wrapper offers the same functionality asFitCurves()but with a standardized API. - New systematicity wrappers with unified output vocabulary:
check_systematic_demand()for purchase task data (wrapsCheckUnsystematic())check_systematic_cp()for cross-price data (wrapscheck_unsystematic_cp())
Both return beezdemand_systematicity objects with identical column
schemas (differing only in NA values for domain-specific fields).
- First-class
tidy()andglance()support is now guaranteed across all beezdemand model classes. All methods return tibbles with standardized columns includingmodel_classandbackend. - All summary objects now inherit from
beezdemand_summarybase class, enabling shared fallback behavior and consistent field availability.
API Standardization
This release introduces **Stability Contracts** for all model classes:
- **summary() objects** now return structured S3 objects with class
c("summary.<class>", "beezdemand_summary"). Required fields include:call,model_class,backend,nobs,n_subjects,converged,logLik,AIC,BIC,coefficients(tibble),notes. - **tidy() methods** return tibbles with columns:
term,estimate,std.error,statistic,p.value. Multi-part models include acomponentcolumn (e.g., "fixed", "variance", "derived"). - **glance() methods** return 1-row tibbles with columns:
model_class,backend,nobs,n_subjects,converged,logLik,AIC,BIC.
API Changes
fit_cp_nls()andfit_cp_linear()now acceptx_var/y_varto map non-standard column names to canonical ones ("x","y").fit_cp_linear()additionally acceptsid_var,group_var, andtarget_var. Default behavior is unchanged when these arguments are omitted.fit_cp_linear()gains explicitfilter_targetandtarget_leveltop-level arguments (previously these were handled implicitly viavalidate_cp_data()). Existing calls without these arguments are unaffected.fit_cp_nls(start_vals=)is deprecated in favor ofstart_values=. The old argument still works but emits a deprecation warning.
---
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-08
- ERROR12 OK, 1 ERROR2026-09-07
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
Show 3 earlier changesHide 3 earlier changes
- ERROR12 OK, 1 ERROR2026-06-08
- OK12 OK2026-04-25
- NOTE11 OK, 3 NOTE2026-03-10
Documentation
- Help pages
- 194 (45 internal)includes a package overview page
- Examples that run
- 28%25 run in a plain check (2 of them under a condition) · 62 only when donttest examples are enabled (R CMD check --as-cran) · 3 hold no code
- Exported functions with examples
- 98%
- Documented parameters
- 99%
- Return-value docs
- 98%
- Help pages citing references
- 1%
- Using beezdemand HTML
- Advanced Mixed-Effects Demand Modeling HTML
- Choosing the Right Demand Model HTML
- Fixed-Effect Demand Modeling with `beezdemand` HTML
- Group Comparisons with Extra Sum-of-Squares F-Test HTML
- How to Use Cross-Price Demand Model Functions HTML
- Hurdle Demand Models HTML
- Migration Guide: FitCurves to fit_demand_fixed HTML
- Mixed-Effects Demand Modeling with `beezdemand` HTML
Downloads
Repository
- PRs merged (all time)
- 73%
- Median days to close, 50 most recently updated closed issues
- 31
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
12 development-tooling and community-health practices detected across 7 families in the upstream repository
Checks run against github.com/brentkaplan/beezdemand on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-09-21 · The repository has a site deploy workflow
pkgdown site last built 2026-09-21
Show all practicesHide 3 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2025-12-24Named in .Rbuildignore: .claude, CLAUDE.mdNamed in .gitignore: .claude, CLAUDE.mdPull request it wrote: opened by a project memberCommits: at least 258 crediting it in the message
- Warpfirst seen 2025-12-24Named in .Rbuildignore: WARP.md
- Gemini CLIfirst seen on or before 2026-07-18Config: a file or ignore line, not recorded which
- Claude Opus 4.659 commits · Feb to Mar 2026
- Claude Opus 4.721 commits · Apr 2026
- Claude Fable 511 commits · Aug 2026
- Claude Opus 4.511 commits · Jan to Feb 2026
- Claude Sonnet 4.59 commits · Feb 2026
1 more model not listed. Some of these counts are a minimum, because the search stopped before the oldest commits.
Dependencies
Installing beezdemand adds 58 packages (27 with compiled code, 54 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, lme4 4.1 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 0.2.0Latest2026-03-03 · current release · diff ↗ ·
removed 1 export
pulladded 50 exports
augment, beezdemand_calc_pmax_omax, beezdemand_calc_pmax_omax_vec, calc_group_metrics, calc_observed_pmax_omax, calc_omax_pmax, calculate_amplitude_persistence, check_demand_model, check_systematic_cp, check_systematic_demand, check_unsystematic_cp, compare_hurdle_models, compare_models, cp_posthoc_intercepts, cp_posthoc_slopes, extract_coefficients, fit_cp_linear, fit_cp_linear.default, fit_cp_linear.mixed, fit_cp_nls, fit_demand_fixed, fit_demand_hurdle, fit_demand_mixed, get_demand_comparisons, get_demand_param_emms, get_demand_param_trends, get_descriptive_summary, get_empirical_measures, get_hurdle_param_summary, get_individual_coefficients and 20 more - RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- 0.1.2
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- RR 4.1.0 released · 2021-05-18
- RR 4.0.0 released · 2020-04-24
- RR 3.6.0 released · 2019-04-26
- 0.1.02018-07-31
- RR 3.5.0 released · 2018-04-23
Package metadata
- First published
- 2018-07-31
- Total releases
- 3 / 8 yrs
- License
- GPL (>= 2) OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 46 KB / 8 files
- Download size
- 5.6 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("beezdemand")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-17, which the citation names so these numbers can be found later. More on citing and the projects behind them.