# Finding threshold for adaptive paradigm via psychometric function

**URL:** <https://discourse.mc-stan.org/t/finding-threshold-for-adaptive-paradigm-via-psychometric-function/9325>\
**Category:** brms\
**Tags:** cognitive-science\
**Created:** [June 19, 2019, 9:02pm UTC](https://discourse.mc-stan.org/t/finding-threshold-for-adaptive-paradigm-via-psychometric-function/9325 "2019-06-19T21:02:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![jades](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jades/32/14827_2.png) [@jades](https://discourse.mc-stan.org/u/jades)\
**Post date:** [July 1, 2019, 12:53am UTC](https://discourse.mc-stan.org/t/finding-threshold-for-adaptive-paradigm-via-psychometric-function/9325/5 "2019-07-01T00:53:41Z")

</div>

So the math formula without the likelihood function would be

![19%20PM](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/e/e0dfaaf1790e02470d17940a985979d02058dfe7.png)

Hmmm, I took your advice and started small–without the lapse parameter or random effects, and I’m still getting an error.

```
Chain 1: Rejecting initial value:
Chain 1: Log probability evaluates to log(0), i.e. negative infinity.
Chain 1: Stan can't start sampling from this initial value.
[1] "Error in sampler$call_sampler(args_list[[i]]) : Initialization failed."

```

I found a page regarding this error: [Rejecting initial value: Log probability evaluates to log(0), i.e. negative infinity](https://discourse.mc-stan.org/t/rejecting-initial-value-log-probability-evaluates-to-log-0-i-e-negative-infinity/5560). I tried different variations of code and samples from the dataset, but couldn’t get it to run.

Was this the full model you had in mind?

```
BF <- bf(
  response ~ inv_logit(guess) + (1 - inv_logit(guess)) * inv_logit((norm - threshold) / spread),
  threshold ~ 1, #+ (norm | pid) + (norm|condition), 
  spread~1,
  guess ~ 1, # + (1|pid) + (1|condition), #(1|p|pid) + (1|c|condition),
  family = bernoulli(link = "identity"), #(link = "probit") 
  nl = TRUE)    
  
priors <- c(
  prior(beta(7, 3), nlpar = "threshold"),
  prior(beta(1.4, 1.4), nlpar = "spread", lb = .005, ub = .5),
  #prior(beta(.5, 8), nlpar = "lapse", lb = 0, ub = .1),
  prior(beta(1, 5), nlpar = "guess", lb = 0, ub = .1)
)  

fit <- brm(
  BF,
  data = ace.threshold.t1.samp, #ace.threshold,
  inits = 0,
  control = list(adapt_delta = 0.99),
  prior = priors
)

```

---

_[View the full topic](https://discourse.mc-stan.org/t/finding-threshold-for-adaptive-paradigm-via-psychometric-function/9325)._
