Skip to contents

Modern Model Fitting

Recommended functions for fitting demand models. These return structured S3 objects with consistent methods for inspection and inference.

fit_demand_fixed()
Fit Fixed-Effect Demand Curves
fit_demand_mixed()
Fit Nonlinear Mixed-Effects Demand Model
fit_demand_hurdle()
Fit Two-Part Mixed Effects Hurdle Demand Model
fit_cp_nls()
Fit cross-price demand with NLS (+ robust fallbacks)
fit_cp_linear() fit_cp_linear.default() fit_cp_linear.mixed()
Fit a Linear Cross-Price Demand Model

Legacy Model Fitting

Original functions for demand curve fitting. These are superseded by modern alternatives but remain available for backward compatibility.

FitCurves()
FitCurves
FitMeanCurves()
Fit Pooled/Mean Curves

Data Quality & Screening

Functions for checking systematic responding patterns in demand data.

check_systematic_demand()
Check Demand Data for Unsystematic Responding
check_systematic_cp()
Check Cross-Price Data for Unsystematic Responding
CheckUnsystematic()
Systematic Purchase Task Data Checker
check_unsystematic_cp()
Check for Unsystematic Patterns in Cross-Price Data

Data Preparation

Functions for preparing and transforming demand data.

pivot_demand_data()
Reshape Demand Data Between Wide and Long Formats
ChangeData()
ChangeData
ReplaceZeros()
Replace Zeros
CheckCols()
Check Column Names
RecodeOutliers()
Recode Outliers

Model Inspection

S3 methods for extracting information from fitted models.

tidy(<beezdemand_fixed>)
Tidy Method for beezdemand_fixed
tidy(<beezdemand_hurdle>)
Tidy a beezdemand_hurdle Model
tidy(<beezdemand_nlme>)
Tidy method for beezdemand_nlme
tidy(<beezdemand_systematicity>)
Tidy Method for beezdemand_systematicity
tidy(<cp_model_lm>)
Extract coefficients from a linear cross-price model in tidy format
tidy(<cp_model_lmer>)
Extract coefficients from a mixed-effects cross-price model in tidy format
tidy(<cp_model_nls>)
Convert a cross-price model to a tidy data frame of coefficients
glance(<beezdemand_fixed>)
Glance Method for beezdemand_fixed
glance(<beezdemand_hurdle>)
Glance at a beezdemand_hurdle Model
glance(<beezdemand_nlme>)
Glance method for beezdemand_nlme
glance(<beezdemand_systematicity>)
Glance Method for beezdemand_systematicity
glance(<cp_model_lm>)
Get model summaries from a linear cross-price model
glance(<cp_model_lmer>)
Get model summaries from a mixed-effects cross-price model
glance(<cp_model_nls>)
Get model summaries from a cross-price model
augment(<beezdemand_fixed>)
Augment a beezdemand_fixed Model with Fitted Values and Residuals
augment(<beezdemand_hurdle>)
Augment a beezdemand_hurdle Model with Fitted Values and Residuals
augment(<beezdemand_nlme>)
Augment a beezdemand_nlme Model with Fitted Values and Residuals
confint(<beezdemand_fixed>)
Confidence Intervals for Fixed-Effect Demand Model Parameters
confint(<beezdemand_hurdle>)
Confidence Intervals for Hurdle Demand Model Parameters
confint(<beezdemand_nlme>)
Confidence Intervals for Mixed-Effects Demand Model Parameters
confint(<cp_model_nls>)
Confidence Intervals for Cross-Price NLS Model Parameters
coef(<cp_model_nls>) coef(<cp_model_lm>) coef(<cp_model_lmer>)
Extract Coefficients from Cross-Price Demand Models
coef(<beezdemand_fixed>)
Extract Coefficients from Fixed-Effect Demand Fit
coef(<beezdemand_hurdle>)
Extract Coefficients from Hurdle Demand Model
coef(<beezdemand_nlme>)
Extract Coefficients from a beezdemand_nlme Model
fixef(<beezdemand_nlme>)
Extract Fixed Effects from a beezdemand_nlme Model
fixef(<cp_model_lmer>)
Extract Fixed Effects from Mixed-Effects Cross-Price Model
ranef(<beezdemand_nlme>)
Extract Random Effects from a beezdemand_nlme Model
ranef(<cp_model_lmer>)
Extract Random Effects from Mixed-Effects Cross-Price Model
AIC(<beezdemand_hurdle>)
AIC for Hurdle Demand Model
BIC(<beezdemand_hurdle>)
BIC for Hurdle Demand Model
logLik(<beezdemand_hurdle>)
Extract Log-Likelihood from Hurdle Demand Model
get_subject_pars()
Get Subject-Specific Parameters
extract_coefficients()
Extract All Coefficient Types from Cross-Price Demand Models

Prediction

Methods for generating predictions from fitted models.

predict(<beezdemand_fixed>)
Predict Method for beezdemand_fixed
predict(<beezdemand_hurdle>)
Predict Method for Hurdle Demand Models
predict(<beezdemand_nlme>)
Predict Method for beezdemand_nlme Objects
predict(<cp_model_lm>)
Predict method for cp_model_lm objects.
predict(<cp_model_lmer>)
Predict from a Mixed-Effects Cross-Price Demand Model
predict(<cp_model_nls>)
Predict from a Cross-Price Demand Model (Nonlinear)

Post-Hoc Analysis

Functions for post-hoc comparisons and inference.

get_demand_param_emms()
Get Estimated Marginal Means for Demand Parameters
get_demand_comparisons()
Get Pairwise Comparisons for Demand Parameters
get_demand_param_trends()
Get Trends (Slopes) of Demand Parameters with respect to Continuous Covariates
get_observed_demand_param_emms()
Get Estimated Marginal Means for Observed Factor Combinations
get_individual_coefficients()
Calculate Individual-Level Predicted Coefficients from beezdemand_nlme Model
cp_posthoc_slopes()
Run pairwise slope comparisons for cross-price demand model
cp_posthoc_intercepts()
Run pairwise intercept comparisons for cross-price demand model

Derived Metrics

Functions for computing demand-derived metrics like Pmax and Omax.

calc_omax_pmax()
Calculate Omax and Pmax for Demand Curves
calc_observed_pmax_omax()
Calculate Observed Pmax/Omax Grouped by ID
calc_group_metrics()
Calculate Group-Level Demand Metrics
beezdemand_calc_pmax_omax()
Calculate Pmax and Omax with Method Reporting and Parameter-Space Safety
beezdemand_calc_pmax_omax_vec()
Calculate Pmax/Omax for Multiple Subjects
get_empirical_measures()
Calculate Empirical Demand Measures
get_descriptive_summary()
Calculate Descriptive Statistics by Price
get_k()
Calculate K Scaling Parameter for Demand Curve Fitting
GetAnalyticPmax()
Get pmax
GetAnalyticPmaxFallback()
Analytic Pmax Fallback
GetEmpirical()
GetEmpirical
GetDescriptives()
Get Purchase Task Descriptive Summary
GetK()
Get K
GetSharedK()
Get Shared K
calculate_amplitude_persistence()
Calculate Amplitude and Persistence

Model Comparison

Functions for comparing models.

compare_hurdle_models()
Compare Nested Hurdle Demand Models
compare_models()
Compare Demand Models
check_demand_model()
Check Demand Model Diagnostics
anova(<beezdemand_hurdle>)
ANOVA Method for Hurdle Demand Models
anova(<beezdemand_nlme>)
ANOVA Method for NLME Demand Models
ExtraF()
ExtraF

Visualization

Plotting functions and themes.

print(<beezdemand_descriptive>) summary(<beezdemand_descriptive>) plot(<beezdemand_descriptive>)
S3 Methods for beezdemand_descriptive Objects
print(<beezdemand_empirical>) summary(<beezdemand_empirical>) plot(<beezdemand_empirical>)
S3 Methods for beezdemand_empirical Objects
plot-theme
beezdemand Plot Theme and Color Palette
plot(<beezdemand_fixed>)
Plot Method for beezdemand_fixed
plot(<beezdemand_hurdle>)
Plot Demand Curves from Hurdle Demand Model
plot(<beezdemand_nlme>)
Plot Method for beezdemand_nlme Objects
plot(<cp_model_lm>)
Plot Method for Linear Cross-Price Demand Models
plot(<cp_model_lmer>)
Plot Method for Mixed-Effects Cross-Price Demand Models
plot(<cp_model_nls>)
Plot a Cross-Price Demand Model (Nonlinear)
plot_qq()
Plot Random Effects Q-Q
plot_residuals()
Plot Residual Diagnostics
plot_subject()
Plot Demand Curve for a Single Subject
PlotCurve()
Plot Curve
PlotCurves()
Plot Curves
theme_beezdemand()
beezdemand Plot Theme
theme_apa()
APA Theme
palette_beezdemand()
beezdemand Color Palette
scale_color_beezdemand()
beezdemand Color Scale (Discrete)
scale_fill_beezdemand()
beezdemand Fill Scale (Discrete)

Transformations

Data transformation utilities.

ll4()
Log-Logistic Transformation (LL4-like)
ll4_inv()
Inverse Log-Logistic Transformation (Inverse LL4-like)
scale_ll4()
Create an LL4-like Scale for ggplot2 Axes
pseudo_ll4_trans()
Create a Pseudo-Log LL4 Transformation Object for ggplot2
lambertW()
Lambert W

Simulation

Functions for simulating demand data.

simulate_hurdle_data()
Simulate Data from Two-Part Mixed Effects Hurdle Demand Model
SimulateDemand()
Simulate Demand Data
run_hurdle_monte_carlo()
Run Monte Carlo Simulation Study for Hurdle Demand Model
print_mc_summary()
Print Monte Carlo Simulation Results
GetValsForSim()
Get Values for SimulateDemand

Summary Methods

Summary functions for parameter exploration.

get_hurdle_param_summary()
Get Hurdle Model Parameter Summary
print(<beezdemand_descriptive>) summary(<beezdemand_descriptive>) plot(<beezdemand_descriptive>)
S3 Methods for beezdemand_descriptive Objects
print(<beezdemand_empirical>) summary(<beezdemand_empirical>) plot(<beezdemand_empirical>)
S3 Methods for beezdemand_empirical Objects
summary(<beezdemand_fixed>)
Summary Method for beezdemand_fixed
summary(<beezdemand_hurdle>)
Summarize a Hurdle Demand Model Fit
summary(<beezdemand_nlme>)
Summary method for beezdemand_nlme
summary(<beezdemand_systematicity>)
Summary Method for beezdemand_systematicity
summary(<cp_model_lm>)
Summary method for cp_model_lm objects.
summary(<cp_model_lmer>)
Summary method for cp_model_lmer objects.
summary(<cp_model_nls>)
Summarize a Cross-Price Demand Model (Nonlinear)
summary(<cp_unsystematic>)
Summarize Cross-Price Unsystematic Data Check Results
print(<anova.beezdemand_hurdle>)
Print Method for ANOVA Comparisons
print(<beezdemand_comparison>)
Print method for beezdemand_comparison objects
print(<beezdemand_diagnostics>)
Print Method for Model Diagnostics
print(<beezdemand_fixed>)
Print Method for beezdemand_fixed
print(<beezdemand_hurdle>)
Print Method for Hurdle Demand Model
print(<beezdemand_model_comparison>)
Print Method for Model Comparison
print(<beezdemand_nlme>)
Print Method for beezdemand_nlme Objects
print(<beezdemand_summary>)
Print Method for beezdemand Summary Objects
print(<beezdemand_systematicity>)
Print Method for beezdemand_systematicity
print(<cp_posthoc>)
Print method for cp_posthoc objects
print(<summary.beezdemand_fixed>)
Print Method for summary.beezdemand_fixed
print(<summary.beezdemand_hurdle>)
Print Summary of Hurdle Demand Model
print(<summary.beezdemand_nlme>)
Print method for summary.beezdemand_nlme
print(<summary.beezdemand_systematicity>)
Print Method for summary.beezdemand_systematicity
print(<summary.cp_model_lm>)
Print method for summary.cp_model_lm objects.
print(<summary.cp_model_lmer>)
Print method for summary.cp_model_lmer objects.
print(<summary.cp_model_nls>)
Print method for summary.cp_model_nls objects
print(<summary.cp_unsystematic>)
Print Method for Cross-Price Unsystematic Summary
print_mc_summary()
Print Monte Carlo Simulation Results

Validation & Data Checking

Functions for validating data inputs.

validate_demand_data()
Validate and Prepare Demand Data
validate_hurdle_data()
Validate Hurdle Demand Data
validate_cp_data()
Validate and Filter Cross-Price Demand Data
validate_collapse_levels()
Validate Collapse Levels Structure
validate_param_scale()
Validate Parameter Scale
new_beezdemand_systematicity()
Create a beezdemand_systematicity Object

Utilities & Helpers

Internal utility functions and helpers.

annotation_logticks2()
annotation_logticks2
build_fixed_rhs()
Build Fixed-Effects RHS Formula String
collapse_factor_levels()
Collapse Factor Levels for a Specific Parameter
format_param_name()
Format Parameter Name with Scale Prefix
get_canonical_metric()
Get Canonical Derived Metric Name
get_canonical_param()
Get Canonical Parameter Name
get_equation_spec()
Get Equation Specification
get_legacy_mapping()
Legacy to Canonical Mapping Table
get_pooled_nls_starts()
Get Starting Values from a Pooled NLS Model (Internal Helper)
calc_omax_pmax_vec()
Calculate Omax and Pmax for Multiple Subjects

Documentation Topics

Documentation-only pages that group related methods.

cp
Example cross‐price dataset
fixed-demand
Fixed-Effect Demand Curve Fitting
param-registry
Parameter Naming Registry for beezdemand
plot-theme
beezdemand Plot Theme and Color Palette
pmax-omax-engine
Pmax/Omax Engine
systematic-wrappers
Systematicity Check Wrappers
coef(<cp_model_nls>) coef(<cp_model_lm>) coef(<cp_model_lmer>)
Extract Coefficients from Cross-Price Demand Models
reexports tidy glance augment
Objects exported from other packages

Example Datasets

Built-in datasets for examples and testing.

apt
Example alcohol purchase task data
apt_full
Full alcohol purchase task dataset
ko
Example nonhuman demand data with drug and dose
etm
Example Experimental Tobacco Marketplace data
cannabisCigarettes
Cannabis/cigarette cross-price responses
lowNicClean
Low-nicotine cigarette purchase task
ongoingETM
Experimental Tobacco Marketplace (ETM) data

Deprecated

Functions that have been deprecated and will be removed in future versions.

pull() deprecated
Pull