Hello!
I would like to incorporate the standard errors for the response variable into the analysis.
Brms is wonderful package and, to my knowledge, it is the only one capable of doing so.
In general, I would like to fit the following model: `
S ~ A + B`
where S is the species diversity estimate, and A & B are experimental factors.
The true diversity is unknown (because of the unseen species), however we can estimate some uncertainty associated with it.
So I can try to use the `
S | se(S.SE) ~ A + B` model.
Standard error of S depends on the number of sampled individuals
(the more individuals we sample, the more we should know about the diversity).
In principal, I can try to use `
S | se(S.SE, sigma = TRUE) ~ A + B, sigma ~ NumSamples`
Is it a proper way of the analysis or there is something I'm missing?
Here are some dummy data illustrating the structure of my dataset:
datt <- data.frame(
S = round(c(rnorm(n = 20, mean = 10, sd = 1), rnorm(n = 20, mean = 15, sd = 1)), 3),
NumSamples = sample(x = 20:200, size = 40),
A = rep(c("A","a"), each = 20), B = rep(c("B", "b")))
datt$S.SE <- round(1/datt$NumSamples * 100, 3)
modd <- brm(
bf(S | se(S.SE, sigma = TRUE) ~ A + B, sigma ~ NumSamples),
data = datt, family = gaussian(),
prior = c(prior(student_t(5,0,10), class = b)))
I really appreciate any help or advice you can provide.
With best regards,
Vladimir