glmmTMB syntax to brm() syntax
Ben, can I ask a similar question? Is there also a function similar to glmmTMB::new_simulate() to easily simulate the following model? nlme::lme(Y ~ condition + Cognitive_Rate, random= ~1 | subject, data = DATA, weights = varIdent(form=~1|condition), correlation = corSymm(form = ~1| subject)) Thank you! Simon
On Thu, Oct 24, 2024 at 9:11?PM Ben Bolker <bbolker at gmail.com> wrote:
Most of the time taken by the brms version is in compilation. It may be possible (I don't remember how) to cache the compiled model and re-use it for subsequent models, if you are going to be (for example) fitting the same model to many different data sets ... On 10/24/24 21:44, Simon Harmel wrote:
Thank you so very much, Ben! And wow, the brm() version is extremely slow. Simon On Thu, Oct 24, 2024 at 11:11?AM Ben Bolker <bbolker at gmail.com> wrote:
See below. The two models (glmmTMB and brms) give sufficiently
similar estimates that I'm confident that the specifications match.
set.seed(101)
library(glmmTMB)
library(brms)
library(broom.mixed)
library(tidyverse)
dd <- data.frame(ID = rep(1:100, each = 10),
TRIAL_INDEX = rep(1:10, 100),
con = rnorm(1000))
dd$pic_percent <- simulate_new(
~ con + (0+con | ID) +
(0+con | TRIAL_INDEX),
ziformula = ~1,
family = beta_family(),
newdata = dd,
newparams = list(beta = c(0, 0.5), theta = rep(-1,2),
betadisp = 1, betazi = -2))[[1]]
m1 <- glmmTMB(pic_percent ~ con + (0+con | ID) +
(0+con | TRIAL_INDEX),
data=dd,
family = beta_family(),
ziformula = ~1)
##
https://mvuorre.github.io/posts/2019-02-18-analyze-analog-scale-ratings-with-zero-one-inflated-beta-models/
m2 <- brm(
bf(pic_percent ~ con + (0+con | ID) +
(0+con | TRIAL_INDEX),
zi = ~ 1),
data=dd,
family = zero_inflated_beta()
)
(purrr::map_dfr(list(glmmTMB = m1, brms = m2), tidy, .id = "model")
|> select(model, effect, component, group, term, estimate)
|> pivot_wider(names_from = model, values_from = estimate)
)
On 10/23/24 19:13, Simon Harmel wrote:
Hello all,
I was wondering what is the closest equivalent of my glmmTMB syntax below
in brms::brm() syntax?
glmmTMBglmmTMB(pic_percent ~ con +
(0+con | ID) +
(0+con | TRIAL_INDEX),
data=DATA,
family = beta_family(),
ziformula = ~1)
Thank you,
Simon
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- Dr. Benjamin Bolker Professor, Mathematics & Statistics and Biology, McMaster University Director, School of Computational Science and Engineering * E-mail is sent at my convenience; I don't expect replies outside of working hours.
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- Dr. Benjamin Bolker Professor, Mathematics & Statistics and Biology, McMaster University Director, School of Computational Science and Engineering * E-mail is sent at my convenience; I don't expect replies outside of working hours.