I fitted a brms model, for which both fixef(model) and as_draws_array(model) yield:
Error: Duplicate variable names are not allowed in draws objects.
The following variable names are duplicates:
{'prior_cor_Subject'}
The model has two random correlation parameters (between intercept and slope), one for mean and one for sigma. The prior on the correlation parameters is:
set_prior("lkj(2)", class="cor")
It seems that posterior_samples(model) works fine (besides a warning that it is deprecated).
Thanks!
Operating System: Linux 5.11.0-37-generic #41~20.04.2-Ubuntu
In this case, even summary(m) produced the same error, which was a surprise:
Error: Duplicate variable names are not allowed in draws objects.
The following variable names are duplicates:
{'prior_sd_Subject', 'prior_cor_Subject'}
Also of note: This seems to happen only when the prior is sampled (I guess because those variable names aren’t in the fit otherwise).
Thanks! Removing sample_prior="yes" does seem to work. But I imagine there are situations in which sampling from the prior is necessary and get_prior() doesn’t cut it? (e.g., prior predictive checks, Savage-Dickey Bayes factors)
EDIT:
Yes, it’s been fixed, thanks! (I was loading a previously fitted model, hence the error was still there.)
Refitting with 2.16.2 works, as the prior sample variables are named differently:
> packageVersion("brms")
[1] ‘2.16.2’
> fixef(m)
Error: Duplicate variable names are not allowed in draws objects.
The following variable names are duplicates:
{'prior_cor_Subject'}