I’m trying to model the positive predictive power of two serology tests but I want the results to be correlated at the individual level in the presence of multiple observations.
To achieve this I duplicated the gold standard variable:
data <- mutate(Ref1 = Ref, Ref2 = Ref)
Then I setup the following formula
f <- mvbrmsformula(
bf(Ref1 | subset(Test1) ~ (1 | g | group) ,
bf(Ref2 | subset(Test2) ~ (1 | g | group )
But when I try it I get:
Error: Length of ‘subset’ do not match the rows of ‘data’.
How can I use brms to keep the two outcome correlated even if different subsets of the data?
Does this thread help?
I would like to model two response variables (y1, y2) using brms multivariate syntax to (1) model each response with a different distribution family, and (2) model the random effects g as correlated. The number of obs for y1 and y2 differ.
The idea is to have something like:
bf_1 <- bf(y1 ~ 1 + (1|ID|g)) + normal()
bf_2 <- bf(y2 ~ 1 + (1|ID|g)) + lognormal()
According to the
brms multivariate vignette, it seems that we need the same number of observations for each component in the formu…
Note also that if the gold standard variable and the test outcomes are binary or categorical, then there are often good reasons to focus on sensitivity and specificity rather than overall predictive power in a regression (the latter will potentially be sensitive to the composition of the sample).
Thanks. It turned out to be a syntax error! I was using isTRUE to manage the missings in the subset variables forgetting it was not a vector function…
Btw, I already modelled sens and spec! PPV and NPV are just to better understand the results!