# utility: Utility Function Models In JanaJarecki/cogscimodels: Cognitive Models - Estimation, Prediction, and Development of Models for Cognitive Scientists

## Description

Fits utility models.

• `utility_pow_c()` fits a power utility for continuous responses.

• `utility_pow_d()` fits a power utility for discrete respoonses.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```utility_pow_d( formula, data, choicerule, fix = list(), discount = 0, options = list(), ... ) utility_pow_c(formula, data, fix = list(), discount = 0, options = list(), ...) ```

## Arguments

 `formula` A formula, the variables in `data` to be modeled. For example, `y ~ x1` models response y as function of one stimulus value x1. `data` A data frame, the data to be modeled. `choicerule` A string, the choice rule. Allowed values, see `cm_choicerules()`: `"none"` is no choice rule, `"softmax"` is soft-maximum, `"luce"` is Luce's axiom. `fix` (optional) A list or the string `"start"`, the fixed model parameters, if missing all parameters are estimated. Model parameter names are `rp`, `rn` (see details - model parameters). `list(rp = 5.40)` sets parameter `rp` equal to 5.40. `list(rp = "rn")` sets parameter `rp` equal to parameter `rn` (estimates `rn`). `list(rn = "rp", rp = 5.40)` sets parameter `rn` equal to parameter `rp` and sets `rp` equal to 5.40 (estimates none of the two). `list(rp = NA)` omits the parameter `rp`, if possible. `"start"` sets all parameters equal to their initial values (estimates none). Useful for building a first test model. `discount` A number, how many initial trials to not use during parameter fitting. `options` (optional) A list, list entries change the modeling procedure. For example, `list(lb = c(k=0))` changes the lower bound of parameter k to 0, or `list(fit_measure = "mse")` changes the goodness of fit measure in parameter estimation to mean-squared error, for all options, see `cm_options()`. `...` other arguments, ignored.

## Details

The power utility U(x) of positive inputs, x > 0, is x^r if r > 0, and is log(x) if r = 0, and is -x^r if r < 0. The power utility of negative inputs x is -U(-x) with a separate exponent r (Wakker, 2008). To fit a power utility with one single exponent for positive and negative x, set `fix = list(rp = "rn")`, not recommended for mixed input.

#### Model Parameters

The model has between 1 and 3 free parameters, depending on model and `data` (see `npar()`):

• `rp` is the power utility exponent for positive data x ≥ 0 (omitted if all x < 0).

• `rn` is the exponent for negative data x < 0 (omitted if all x ≥ 0).

• In `utility_pow_c()`: `sigma` is the standard deviation of the normally-distributed loglikelihood of the responses.

• In `utility_pow_d()`: If `choicerule = "softmax"`: `tau` is the temperature or choice softness, higher values cause more equiprobable choices. If `choicerule = "epsilon"`: `eps` is the error proportion, higher values cause more errors from maximizing.

## Value

Returns a cognitive model object, which is an object of class cm. A model, that has been assigned to `m`, can be summarized with `summary(m)` or `anova(m)`. The parameter space can be viewed using `pa. rspace(m)`, constraints can be viewed using `constraints(m)`.

## Author(s)

Jana B. Jarecki, jj@janajarecki.com

## References

Wakker, P. P. (2008). Explaining the characteristics of the power (CRRA) utility family. Health Economics, 17(12), 1329-1344. doi:10.1002/hec.1331

Tversky, A. (1967). Utility theory and additivity analysis of risky choices. Journal of Experimental Psychology, 75(1), 27-36. doi:10.1037/h0024915

Other cognitive models: `baseline_const_c()`, `bayes()`, `choicerules`, `cpt`, `ebm()`, `hm1988()`, `shortfall`
 `1` ```# No examples yet ```