threshold: Threshold Model

Description Usage Arguments Details Value Parameter Space Author(s) Examples

View source: R/model-treshold.R

Description

treshold() fits a threshold model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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(),
  ...
)

Arguments

formula

A formula specifying choice ~ var

...

other arguments from other functions, currently ignored.

Details

Given the formula y ~ a the model predicts y = 1 for a >= nu and y = 0 for a < nu

Value

A model of class "treshold". It can be viewed with summary(mod), where mod is the name of the model object.

Parameter Space

Name LB - UB Description Start Value
nu -Inf - Inf Treshold 0

Author(s)

Jana B. Jarecki

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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   

JanaJarecki/cogscimodels documentation built on Sept. 8, 2020, 7:28 p.m.