Fits curve to pooled or mean data
FitMeanCurves(
dat,
equation,
k,
remq0e = FALSE,
replfree = NULL,
rem0 = FALSE,
nrepl = NULL,
replnum = NULL,
plotcurves = FALSE,
method = NULL,
indpoints = TRUE,
vartext = NULL
)Data frame
data frame (long form) of purchase task data.
Character vector of length one. Accepts either "hs" for Hursh and Silberberg (2008) or "koff" for Koffarnus, Franck, Stein, and Bickel (2015).
A numeric vector of length one. Reflects the range of consumption in log10 units. If none provided, k will be calculated based on the max/min of the entire sample. If k = "fit", k will be a free parameter
If TRUE, removes consumption and price where price == 0. Default value is FALSE
Optionally replaces price == 0 with specified value. Note, if fitting using equation == "hs", and 0 is first price, 0 gets replaced by replfree. Default value is .01
If TRUE, removes all 0s in consumption data prior to analysis. Default value is FALSE.
Number of zeros to replace with replacement value (replnum). Can accept either a number or "all" if all zeros should be replaced. Default is to replace the first zero only.
Value to replace zeros. Default is .01
Boolean whether to create plot. If TRUE, a "plots/" directory is created one level above working directory. Default is FALSE.
Character string of length 1. Accepts "Mean" to fit to mean data or "Pooled" to fit to pooled data
Boolean whether to plot individual points in gray. Default is TRUE.
Character vector specifying indices to report on plots. Valid indices include "Q0d", "Alpha", "Q0e", "EV", "Pmaxe", "Omaxe", "Pmaxd", "Omaxd", "K", "Q0se", "Alphase", "R2", "AbsSS"
Brent Kaplan bkaplan.ku@gmail.com
FitMeanCurves() has been superseded by fit_demand_fixed() with the
agg parameter. FitMeanCurves() will continue to work but is no longer
recommended for new code. See vignette("migration-guide") for migration
instructions.
fit_demand_fixed() for the modern interface with agg parameter
## Fit aggregated data (mean only) using Hursh & Silberberg, 2008 equation with a k fixed at 2
FitMeanCurves(apt[sample(apt$id, 5), ], "hs", k = 2, method = "Mean")
Run the code above in your browser using DataLab