paul-buerkner / brms

brms R package for Bayesian generalized multivariate non-linear multilevel models using Stan
https://paul-buerkner.github.io/brms/
GNU General Public License v2.0
1.25k stars 177 forks source link

Savage-Dickey density ratios aren't computed with QR decomposition #1640

Closed josh-fiechter closed 2 months ago

josh-fiechter commented 2 months ago

I've noticed that the hypothesis function returns NA for the Evid.Ratio with QR decomposition, even with specified priors. E.g.:

x <- rnorm(100)
y <- rnorm(100)
data <- data.frame(cbind(x, y))

bf1 <- bf(y~x, decomp = "QR")
prior1 <- prior(normal(0,1), class = b)
fit <- brm(bf1,
           prior = prior1,
           sample_prior = "yes",
           data = data)
hypothesis(fit, "x = 0")
## `Evid.Ratio` returns NA

The issue appears to stem from mismatched naming conventions for prior draws (i.e., bQ_) and final transformed parameter estimates (i.e., b_). Thanks for your help!

paul-buerkner commented 2 months ago

there is nothing really brms can do to fix this. it would be too much effort to get it to work in this case. I recommend you perform bayes factor computation via the bayes_factor method instead.

josh-fiechter @.***> schrieb am Sa., 6. Apr. 2024, 23:40:

I've noticed that the hypothesis function returns NA for the Evid.Ratio with QR decomposition, even with specified priors. E.g.:

x <- rnorm(100) y <- rnorm(100) data <- data.frame(cbind(x, y))

bf1 <- bf(y~x, decomp = "QR") prior1 <- prior(normal(0,1), class = b) fit <- brm(bf1, prior = prior1, sample_prior = "yes", data = data) hypothesis(fit, "x = 0")

Evid.Ratio returns NA

The issue appears to stem from mismatched naming conventions for prior draws (i.e., bQ) and final transformed parameter estimates (i.e., b). Thanks for your help!

— Reply to this email directly, view it on GitHub https://github.com/paul-buerkner/brms/issues/1640, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCW2ABZYJTJPEIM3D76G53Y4BMVBAVCNFSM6AAAAABF2WSE6GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZDSNBRGU4TGNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>