beezdemand 0.2.0
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.
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. (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_systematicityobjects 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.
beezdemand 0.1.3
Deprecations
The following deprecations will take effect in version 0.2.0:
beezdemand::pull()is deprecated in favor ofdplyr::pull(). The beezdemand version was a legacy helper that predates the dplyr function.The
inverse_funargument insummary.cp_model_nls(),plot.cp_model_nls(), andpredict.cp_model_nls()is deprecated in favor ofinv_funfor consistency with mixed-effects model methods.
API Improvements
Standardized argument names across cross-price model methods (
inv_funinstead ofinverse_fun)Cross-price plot methods now have consistent argument ordering across
plot.cp_model_nls(),plot.cp_model_lm(), andplot.cp_model_lmer()-
Key user-facing functions now return tibbles for better compatibility with
tidyverse workflows:
predict.cp_model_nls(),predict.cp_model_lm(),tidy.cp_model_nls(),glance.cp_model_nls() Added standardized error helpers (
validation_error(),fitting_error(),missing_package_error()) for consistent error messagingcheck_unsystematic_cp()now returns an object of classcp_unsystematicwith propersummary()method dispatch (no longer overridessummary.tbl_df())
New Features
Two-Part Mixed Effects Hurdle Demand Models
-
Added comprehensive hurdle model functionality using TMB (Template Model Builder):
fit_demand_hurdle(): Fit two-part hurdle models with 2 or 3 random effectsPart I models probability of zero consumption (logistic regression with random intercept)
Part II models log-consumption given positive response (nonlinear mixed effects)
-
S3 methods for
beezdemand_hurdleobjects: -
Utility functions:
calc_omax_pmax(): Calculate Pmax and Omax from demand parametersget_subject_pars(): Extract subject-specific parameter estimatescompare_hurdle_models(): Likelihood ratio test for model comparisonget_hurdle_param_summary(): Summary statistics for individual parameters
-
Simulation functions:
simulate_hurdle_data(): Generate synthetic hurdle model datarun_hurdle_monte_carlo(): Monte Carlo simulation studies
New vignette “Hurdle Demand Models” with comprehensive examples
New dataset
apt_full: Full alcohol purchase task data with 1,100 subjects and demographic covariates
Cross-Price Demand Models
-
Added comprehensive cross-price demand model functionality:
check_unsystematic_cp(): Check for unsystematic data in cross-price modelsfit_cp_nls(): Nonlinear model fitting for cross-price demand datafit_cp_linear(): Linear model fitting for cross-price demand data with options for fixed effects and mixed-effects models-
New utility functions for cross-price model objects:
extract_coefficients(): Extract model coefficients in tidy formatcp_posthoc_slopes()andcp_posthoc_intercepts(): Post-hoc comparisons for model parametersvalidate_cp_data(): Validate and filter cross-price demand data
-
Added new vignette “How to Use Cross-Price Demand Model Functions” demonstrating:
Required data structure for cross-price analyses
Checking for unsystematic data
Both two-stage and pooled model fitting approaches
Linear and mixed-effects modeling options
Model visualization and coefficient extraction
Post-hoc comparisons
beezdemand 0.1.2
CRAN release: 2023-08-26
No longer relies on
nlmrtand instead relies onnlsrFixes an issue where CheckUnsystematic may not flag certain cases when data are passed as
tibbleFixes deprecated arguments in
ggplot2Add ability to specify a start value for alpha in
ExtraF()function
beezdemand 0.1.1
- Add experimental features for
FitCurves(). These arguments areconstrainq0,startq0, andstartalpha. These arguments allow Q0 to be constrained so alpha is the only fitted parameter and allow for user-specified starting values.
beezdemand 0.0.91
New updates
GetSharedK()updated to work better and faster at finding a reasonable valueInternal helper functions added to optimize
GetSharedK()
beezdemand 0.0.90
New updates
ExtraF()now compares alpha and Q0A number of functions now allows you to specify the column names
beezdemand 0.0.85
New updates
FitCurves()correctly pulls alpha and q0 standard errors when k is fitted as a free parameter. Also no longer accepts data transformations. Must be done prior to fitting usingChangeData().FitCurves()now fits mean/pooled data based onmethodargument.GetSharedK()no longer accepts data transformations.
beezdemand 0.0.84
New updates
New
ChangeData()will soon serve as the replacement toReplaceZeros()and other arguments specified inFitCurves().For the time being,
FitCurves()will actually output a list object. This may cause failures with old scripts. Try modifying scripts to take the first element out of the list. This will soon be taken care of.
beezdemand 0.0.6
New features
New
FitMeanCurves()will fit curve to averaged or pooled data. Can also make plots.FitCurves()can now make plots.GetDescriptives()can make box and whisker plots.
