View source: R/model-treshold.R
| threshold | R Documentation |
treshold() fits a threshold model with the threshold as free parameter.
treshold_c() models continuous responses in form of the distance to a threshold
treshold_d() models discrete choices given the distance to a threshold
threshold( formula, data, fix = list(), choicerule = NULL, mode, discount = 0L, options = list(), ... ) threshold_c( formula, data, fix = list(), choicerule = NULL, discount = 0, options = list(), ... ) threshold_d( formula, data, fix = list(), choicerule = "softmax", discount = 0, options = list(), ... )
formula |
A formula, the variables in |
data |
A data frame, the data to be modeled. |
fix |
(optional) A list with parameter-value pairs of fixed parameters. If missing all free parameters are estimated. If set to
|
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, |
... |
other arguments, ignored. |
Given the formula y ~ a the model predicts y = 1 for a >= nu and y = 0 for a < nu
A model of class "treshold".
nu: the threshold.
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
Jana B. Jarecki
Other cognitive models:
baseline_const_c(),
bayes(),
choicerules,
cpt,
ebm(),
hm1988(),
shift(),
shortfall,
utility
D <- data.frame(
y = rep(0:1, each=5),
a = 1:10)
M <- threshold_c(y ~ a, D, fix="start") # fixed par. to start values
predict(M) # predict dist. to threshold
anova(M) # anova-like table
summary(M) # summarize
M <- threshold_d(y ~ a, D, fix="start") # fixed par. to start values
predict(M) # predict dist. to threshold
anova(M) # anova-like table
summary(M) # summarize
M$MSE() # mean-squared error
### Binary response given a threshold
# --------------------------------------------
M <- threshold(y ~ a, D, fix="start", choicerule = "softmax")
predict(M) # --"-- maximum posterior
anova(M) # anova-like table
summary(M) # summarize
M$MSE() # mean-squared error
### Parameter specification and fitting
----------------------------------------
# Use a response variable, y, to which we fit parameter
threshold(y ~ a, D, fix = "start", "softmax") # "start" fixes all par.,
# and fits none
threshold(y ~ a , D, list(nu=2), "softmax") # fix threshold nu to 2
threshold(y ~ a, D, list(tau=0.5), "softmax") # fix soft-max tau to 1
threshold(y ~ a, D, choicerule = "softmax") # nu and tau free param
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.