
Shifting Cognitive Model
shift.Rd
Fits a model that shifts over time from one value to another value, with the change point in time being a free parameter
shift_d()
fits the change point model for discrete responses.
Arguments
- formula
A formula, the variables in
data
to be modeled. For example,y ~ x1 + x2
models response y as function of shifting fromx1
tox2
.- data
A data frame, the data to be modeled.
- time
(optional) Variable with the decision time or trial across which the shift occurs; can be a numeric vector, string, or formula. If missing will be set to range from 1 to the number of rows in data.
- fix
(optional) A list with parameter-value pairs of fixed parameters. If missing all free parameters are estimated. If set to
"start"
all parameters are fixed to their start values. Model parameter names arec
(see details - model parameters).list(c = 1.85)
sets parameterc
equal to 1.85."start"
sets all parameters equal to their initial values (estimates none). Useful for building a first test model.
- 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, orlist(fit_measure = "mse")
changes the goodness of fit measure in parameter estimation to mean-squared error, for all options, see cm_options.- discount
(optional) A number, e.g.
10
ignores the first ten data rows when fitting parameters and when calculating goodness of fits- ...
other arguments, ignored.
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)
.
Details
The model models a shift between two input values over time.
Parameter Space
The model has 1 free parameter:
c
the change point when the shift occurs intime
Additoinal parameters in
shift_c()
: Ifchoicerule = "softmax"
:tau
is the temperature or choice softness, higher values cause more equiprobable choices. Ifchoicerule = "epsilon"
:eps
is the error proportion, higher values cause more errors from maximizing.
See also
Other cognitive models:
Cm
,
baseline_const_c()
,
bayes()
,
choicerules
,
cpt
,
ebm()
,
hm1988()
,
shortfall
,
threshold
,
utility
Author
Jana B. Jarecki, jj@janajarecki.com
Examples
## Make fake data -----------------------------------------------------
D <- data.frame(a = rep(0L,4), b = 1L, y = c(0,0,1,1))
M <- shift_d(~ a + b, D, fix = c(c=1.5))
predict(M)
#> [1] 4.539787e-05 9.999546e-01 1.000000e+00 1.000000e+00