Hi Community,

I am running a signal detection model using brm on 43 subjects with appx. 700 trials per subject.

I provide a small example dataset with 4 subjects.

I want to add beta power as a regressor, to see whether beta power correlates with the criterion or sensitivity. As the single trial values for beta power are very small, I log transform the values. is it okey to do that in the model syntax:

```
#make factors
cue_power$ID = as.factor(cue_power$ID) # subject ID
cue_power$isyes = as.factor(cue_power$isyes) # signal or noise trial (1 or 0)
cue_power$sayyes = as.factor(cue_power$sayyes) # detection response (yes or no, 1 or 0)
# fit the model
glm_power <- brm(sayyes ~ 1 + isyes*log10(beta) + (1 + isyes*log10(beta)| ID),
family = bernoulli(link = "probit"),
data = cue_power,
cores = 10,
thin = 2,
iter = 4000,
file = "SDT_mixedmodel_power200prestimulus.rds",
control = list(adapt_delta = 0.99)
)
```

I get the following error msg:

Chain 4: Rejecting initial value:

Chain 4: Log probability evaluates to log(0), i.e. negative infinity.

Chain 4: Stan can’t start sampling from this initial value.

Chain 4:

Chain 4: Initialization between (-2, 2) failed after 100 attempts.

Chain 4: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.

[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”

[2] “Zusätzlich: Warnmeldungen:”

[3] "1: Paket ‘ggplot2’ wurde unter R Version 4.1.2 erstellt "

[4] "2: vorhergehender Import ‘lifecycle::last_warnings’ durch ‘rlang::last_warnings’ während des Ladens von ‘tibble’ ersetzt "

[5] "3: vorhergehender Import ‘lifecycle::last_warnings’ durch ‘rlang::last_warnings’ während des Ladens von ‘pillar’ ersetzt "

[1] “error occurred during calling the sampler; sampling not done”

I assume I get this error because of the negative log values. But if I transform my values before model specification I still have negative values. Not sure how to proceed here. Any ideas?

Another small question: Where can I see which value is the base value if I have factorial predictors? Does brms always use the 0 coded variable as base?

Best,

Carina

sdt_power_sample.csv (332.6 KB)