Logistic regression

Hello everyone,

I am a beginner in Stan and Bayesian statistics. I am attempting to conduct a logistic regression through Bayesian approach. The dataset is a subsection of examination with 37 items and 87 respondents.

response: 1=correct, 0=incorrect
time: response time in seconds
fresponse: 1=fast response, 0=slow response (based on median response time per item)
sresponse: 1=slow response, 0=fast response (based on median response time per item)

There are two research questions: 1. What is the relationship between response accuracy and response speed? 2. What is the correlation between response accuracy and type of response time (fast response vs slow response) after controlling for ability of people?

Here are the data file and Stan code I wrote. Could anyone help debug and complete it?
Thank you in advance.
Stan_GRE copy 2.r (2.2 KB)
GREdata.txt (62.5 KB)

It helps if you can ask specific questions. I’m afraid we don’t have time to dive into random user code and help debug.

In your case, you’re using a variable mu before you define it. And your prior on sigma doesn’t match the definition (the definition needs upper = 1).

You want to just use binomial_logit here rather than trying to do your own logit (which is missing a key negation).