[R-sig-ME] Hierarchical Psychometric Function in BRMS

Ades, James j@de@ @end|ng |rom he@|th@uc@d@edu
Mon Mar 16 04:27:34 CET 2020


Hi all,

Given that this is a mixed-model listserv, I'm hoping that a BRMS question might fit within that purview.

A quick synopsis of the dataset: there are 14 different conditions of executive function tasks ( ~1000 3rd, 5th, 7th graders). Given that these tasks use an adaptive paradigm (tasks might have anywhere from 25 to 40 trials), I'm trying to disentangle the response window at which participants reach a 70% performance threshold. There are four separate timepoints. (I'm not sure whether the four timepoints can be fit at once because probability distributions for random factor of participant are already used to account for repeated measures of participant completing 14 conditions, but that question is secondary to ensuring that I'm fitting one time point correctly and adequately extracting those the intercept/slope parameters).

If I were to only input this into glmer without the priors, I'd write the model as:
```
glmer(response ~  condition * norm + (norm | pid/condition)
```
(In a glmer model, I can extract intercept/slope parameters fine).

My current model is below. My question isn't so much with the psychometric function or the priors, which, besides the threshold, I've borrowed from Treutwein and Strasburger: https://link.springer.com/article/10.3758/BF03211951--though if there are contentions with any of the those, feel free to raise them--as it is whether I've correctly structured the non-linear parameters. The reason for modeling all four parameters is to minimize bias, but threshold is the only estimate that I'm concerned with. So regarding the multi-level structure, I've created parameters for lapse, guess, spread, and threshold. It seems reasonable to expect that threshold and spread will vary for every participant for every condition, while lapse and guessing (forced yes/no) will likely not differ much from condition to condition within participant (though if there are arguments that it would make for an improved model, I'm fine including lapse and guess parameters for every condition as well).

The other problem I'm having is using coef() or fixef()/ranef() to withdraw (or locate) the overall intercept and slope such that I can use the qlogis() function to determine the psychometric threshold at 70% (since I don't think it would be accurate to directly pull the 70% threshold estimate from the parameter itself?).

Does all of that make sense? This is all a little bit over my head and though I've culled Buerkner's item-response vignettes (Here: https://cran.r-project.org/web/packages/brms/vignettes/brms_nonlinear.html and here: https://arxiv.org/pdf/1905.09501.pdf, they're similar but fundamentally different, so they only get me so far).

I've included a small sample of ~five participants here: https://drive.google.com/file/d/1YFnQRSjnp5hVziQx5wQzaIhn75KigaGx/view?usp=sharing

Thanks in advance for any and all help! Hope everyone is staying healthy!

James


```
thresholds <- bf(
  response ~ (gamma + (1 - lambda - gamma) * Phi((norm - threshold)/spread)),
  threshold ~ 1 + (1|p|pid) + (1|c|condition),
  logitgamma  ~ 1 + (1|p|pid),
  nlf(gamma ~ inv_logit(logitgamma)),
  logitlambda ~ 1 + (1|p|pid),
  nlf(lambda ~ inv_logit(logitlambda)),
  spread ~ 1 + (1|p|pid) + (1|c|condition),
nl = TRUE)

prior <-
  prior(beta(9, 3), class = "b", nlpar = "threshold", lb = 0, ub = 1) +
  prior(beta(1.4, 1.4), class = "b", nlpar = "spread", lb = .005, ub = .5) +
  prior(beta(.5, 8), nlpar = "logitlambda", lb = 0, ub = .1)+
  prior(beta(1, 5), nlpar = "logitgamma", lb = 0, ub = .1)

fit_thresholds <- brm(
  formula = thresholds,
  data = ace.threshold.t1.samp,
  family = bernoulli(link = "identity"),
  prior = prior,
  control = list(adapt_delta = .85, max_treedepth = 15),
  inits = 0,
  chains = 1,
  cores = 16
)
```



[https://media.springernature.com/w110/springer-static/cover/journal/13414.jpg]<https://link.springer.com/article/10.3758/BF03211951>
Fitting the psychometric function | SpringerLink<https://link.springer.com/article/10.3758/BF03211951>
A constrained generalized maximum likelihood routine for fitting psychometric functions is proposed, which determines optimum values for the complete parameter set�that is, threshold and slopeas well as for guessing and lapsing probability. The constraints are realized by Bayesian prior distributions for each of these parameters. The fit itself results from maximizing the posterior ...
link.springer.com

Abstract R arXiv:1905.09501v2 [stat.CO] 20 Jul 2019<https://arxiv.org/pdf/1905.09501.pdf>
Paul-Christian B urkner 3 dictions via a nested non-linear formula syntax, the implementation of several distributions designed for response times data, and extentions of distributions for ordinal data, for example
arxiv.org

Estimating Non-Linear Models with brms<https://cran.r-project.org/web/packages/brms/vignettes/brms_nonlinear.html>
Introduction. This vignette provides an introduction on how to fit non-linear multilevel models with brms.Non-linear models are incredibly flexible and powerful, but require much more care with respect to model specification and priors than typical generalized linear models.
cran.r-project.org



	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list