Skip to content

beezdemand

0.2.0

Behavioral Economic Easy Demand

1packages depend
4Kdownloads / year
63.4%test coverage
13/13flavors OK

Overview

About

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.

Changes in 0.2.0

Deprecations

  • FitCurves() is now superseded by fit_demand_fixed(). FitCurves() will continue to work but emits a soft deprecation warning. The new function provides a modern S3 interface with summary(), tidy(), glance(), predict(), and plot() methods. See vignette("migration-guide") for migration instructions.
  • FitMeanCurves() is now superseded by fit_demand_fixed(agg = "Mean") or fit_demand_fixed(agg = "Pooled").

New Features

Koffarnus Equation for Mixed-Effects Models

  • fit_demand_mixed() now supports the Koffarnus et al. (2015) exponentiated equation via equation_form = "koff". This enables fitting demand curves using the same equation form available in FitCurves() within the modern hierarchical mixed-effects framework. The k parameter 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, .resid
  • augment.beezdemand_hurdle(): Returns .fitted, .fitted_link, .fitted_prob, .resid, .resid_response
  • augment.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 models
  • anova.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. (Named check_demand_model() to avoid conflict with performance::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 the augment() 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 of k. Available in FitCurves() output (columns alpha_star and alpha_star_se), tidy() on beezdemand_fixed objects, and tidy() on beezdemand_hurdle objects. Standard errors are obtained via the delta method. See ?param-registry for details.

Modern Wrappers for Legacy Functions

  • New get_empirical_measures() as a modern replacement for GetEmpirical(). Returns a beezdemand_empirical S3 object; access the results via $measures.
  • New get_descriptive_summary() as a modern replacement for GetDescriptives(). Returns a beezdemand_descriptive S3 object; access the results via $statistics.
  • New get_k() as a modern replacement for GetK(). 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, and cp_model_nls.
  • New migration guide vignette (vignette("migration-guide")) documenting the transition from FitCurves() to fit_demand_fixed().

Breaking Changes

  • summary() methods for beezdemand_hurdle and beezdemand_nlme now return structured summary objects instead of printing directly. Use print(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; the param_space argument 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 the log10(y) response scale and filters y <= 0 with a warning. predict.cp_model_nls() now always returns y_pred on the natural y scale; for "exponential" it additionally returns y_pred_log10 (and no longer returns y_pred_natural).

Additional New Features

  • New fit_demand_fixed() function provides a modern interface for individual demand curve fitting. Returns a structured S3 object with summary(), tidy(), and glance() methods. This wrapper offers the same functionality as FitCurves() but with a standardized API.
  • New systematicity wrappers with unified output vocabulary:
  • check_systematic_demand() for purchase task data (wraps CheckUnsystematic())
  • check_systematic_cp() for cross-price data (wraps check_unsystematic_cp())

Both return beezdemand_systematicity objects with identical column

schemas (differing only in NA values for domain-specific fields).

  • First-class tidy() and glance() support is now guaranteed across all beezdemand model classes. All methods return tibbles with standardized columns including model_class and backend.
  • All summary objects now inherit from beezdemand_summary base 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 a component column (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() and fit_cp_linear() now accept x_var/y_var to map non-standard column names to canonical ones ("x", "y"). fit_cp_linear() additionally accepts id_var, group_var, and target_var. Default behavior is unchanged when these arguments are omitted.
  • fit_cp_linear() gains explicit filter_target and target_level top-level arguments (previously these were handled implicitly via validate_cp_data()). Existing calls without these arguments are unaffected.
  • fit_cp_nls(start_vals=) is deprecated in favor of start_values=. The old argument still works but emits a deprecation warning.

---

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 13.1 min · r-oldrel-windows-x86_64
Status changes
  • 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
Advisories

none known

Documentation

In release 0.2.0
READMEYes · 4,593 wordsVignettesYes · 9 · dynamicNEWSYes · 100% structured · mentions 0.2.0Citation fileYes · cites a publicationWebsiteYes · pkgdown
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%

Downloads

4K
CRAN downloads in the past year
Rank #7,042 · ~11/day · ~330/mo
Daily download trend is not available in this view yet.
50630 days
1.2K90 days
4K1 year
Compare downloads with other packages →
Also on457 r2u47 autocran

Repository

17Stars
6Forks
1Open issues
1Open PRs
3Releases
661Commits
4Commit identities
661 commits · Last activity 2026-09-21 · 0% stars, 30d · Default branch at 0.3.0, ahead of CRAN 0.2.0 (checked 2026-10-11)
Responsiveness
How these are sampled
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

2025-09-20 · 172026-07-07 · 17
PracticesBeta

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.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-09-21 · The repository has a site deploy workflow

pkgdown site last built 2026-09-21

Coverage (1)
Coverage reporting
Reproducibility and dev environment (2)
renvdata-raw/
Show all practicesHide 3 practices
CRAN release process (1)
cran-comments.md
Automation and maintenance (1)
Dependabot
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2025-12-24
    Named in .Rbuildignore: .claude, CLAUDE.md
    Named in .gitignore: .claude, CLAUDE.md
    Pull request it wrote: opened by a project member
    Commits: at least 258 crediting it in the message
  • Warpfirst seen 2025-12-24
    Named in .Rbuildignore: WARP.md
  • Gemini CLIfirst seen on or before 2026-07-18
    Config: a file or ignore line, not recorded which
Models named in its commits
  • 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.

Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
32 external dependencies (excludes base and recommended)

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.

Depends (1)
R >= 4.1.0
LinkingTo (2)
Enhances (0)
none
Reverse dependencies
1direct
0indirect
Imports 1
Depends, Imports or LinkingTo, most downloaded first

Datasets

People & History

People (2)
Author, Maintainer since 0.1.0 (2018), Copyright holder
Contributor
Releases (3)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 0.2.0Latest
    record
    2026-03-03 · current release · diff ↗ ·
    removed 1 export
    pull
    added 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
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • 0.1.2
    record
    2023-08-26 · diff ↗ ·
    added 3 exports
    GetAnalyticPmax, GetAnalyticPmaxFallback, lambertW
  • R
    R 4.3.0 released · 2023-04-21
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
  • 0.1.0
    record
    2018-07-31
  • R
    R 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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for beezdemand version 0.2.0 [Data set]. HJJB, LLC. Data release v2026-10-17. https://doi.org/10.5281/zenodo.21843040

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.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy