FitCurves: FitCurves

Description Usage Arguments Value Author(s) Examples

View source: R/analyze.R

Description

Analyzes purchase task data

Usage

1
2
FitCurves(dat, equation, k, agg = NULL, detailed = FALSE, xcol = "x",
  ycol = "y", idcol = "id", groupcol = NULL, lobound, hibound)

Arguments

dat

data frame (long form) of purchase task data.

equation

Character vector of length one. Accepts either "hs" for Hursh and Silberberg (2008) or "koff" for Koffarnus, Franck, Stein, and Bickel (2015).

k

A numeric (or character) 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 + .5. If k = "ind", k will be calculated per individual using max/min + .5. If k = "fit", k will be a free parameter on an individual basis. If k = "range", k will be calculated based on the max/min of the entire sample + .5.

agg

Character vector of length one accepts either "Mean" or "Pooled". If not NULL (default), data will be aggregrated appropriately and analyzed in the specified way.

detailed

If TRUE, output will be a 3 element list including (1) dataframe of results, (2) list of model objects, (3) list of individual dataframes used in fitting. Default value is FALSE, which returns only the dataframe of results.

xcol

The column name that should be treated as "x" data

ycol

The column name that should be treated as "y" data

idcol

The column name that should be treated as dataset identifier

groupcol

The column name that should be treated as the groups

lobound

Optional. A named vector of length 2 ("q0", "alpha") or 3 ("q0", "k", "alpha"), the latter length if k = "fit", specifying the lower bounds.

hibound

Optional. A named vector of length 2 ("q0", "alpha") or 3 ("q0", "k", "alpha"), the latter length if k = "fit", specifying the upper bounds.

Value

If detailed == FALSE (default), a dataframe of results. If detailed == TRUE, a 3 element list consisting of (1) dataframe of results, (2) list of model objects, (3) list of individual dataframes used in fitting

Author(s)

Brent Kaplan <bkaplan.ku@gmail.com> Shawn Gilroy <shawn.gilroy@temple.edu>

Examples

1
2
## Analyze using Hursh & Silberberg, 2008 equation with a k fixed to 2
FitCurves(apt[sample(apt$id, 5), ], "hs", k = 2)

beezdemand documentation built on May 2, 2019, 9:27 a.m.