hm1988 | R Documentation |
hm1988()
generates Houston & McNamara's (1988) optimal model for risk-sensitive foraging with discrete choices.
hm1988( formula, trials, states, budget, ntrials, initstate = 0, data = NULL, choicerule = "argmax", fix = list(), options = NULL, fitnessfun = NULL )
formula |
A formula, the variables in |
trials |
The variable in |
states |
The variable in |
budget |
A number; the goal/requirement/critical state, that matters in the terminal payout function. Can also be a numeric vector of length |
ntrials |
A number; the total number of trials available. Can also be a numeric vector of length |
initstate |
(default 0) A number; the starting state in the first trial. Can also be a numeric vector of length |
data |
A data frame, the data to be modeled. |
choicerule |
A string, the choice rule. Allowed values, see |
fix |
(optional, only for
|
options |
(optional) A list, list entries change the modeling procedure. For example, |
fitnessfun |
(optional) A function, the terminal fitness function, needs two arguments, |
discount |
A number, how many initial trials to not use during parameter fitting. |
... |
other arguments, ignored. |
Risk-sensitive foraging means you have, for instance, four choices between the same two risky lotteries and after the four choices you need to have accumulated at least 12 points to get a reward. The optimal solution to this choice problem relies on dynamic programming. The function creates all possible future states given the possible remaining trials, and predicts the optimal choice polica or the expected value of chosing either option given a certain state and a certain time horizon.
The model has no free parameters. If choicerule
is specified, it can estimate 1 free parameter: 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.
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)
.
Jana B. Jarecki, jj@janajarecki.com
Houston, A. I., & McNamara, J. M. (1988). A framework for the functional analysis of behaviour. Behavioural and Brain Science, 11, 117-163. doi:10.1017/S0140525X00053061
Other cognitive models:
baseline_const_c()
,
bayes()
,
choicerules
,
cpt
,
ebm()
,
shift()
,
shortfall
,
threshold()
,
utility
## Make fake data ----------------------------------------------------- D <- data.frame( x1 = 0, x2 = 1, x3 = 2, px11 = 0.1, px12 = 0.8, px13 = 0.1, px21 = 0.4, px22 = 0.2, px23 = 0.4, s = rep(9:11, each = 4), init = rep(9:11, each = 4), t = 4:1) ## Setup the model -------------------------------------------------- M <- hm1988(~ x1+px11+x2+px12+x3+px13 | x1+px21+x2+px22+x3+px23, trials = ~t, states = ~s, budget = 12, ntrials = 4, initstate = ~init, data = D, choicerule = "argmax") M # View model predict(M) # Predict choice probability of 1st option (arg-max) predict(M, type="values") # Predict expected values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.