Hi, let me say straight up I am new to this sort of modeling, apologies for any faux pas both in asking this question and my modeling.
I am currently trying to simulate data for a non-linear model I have developed, with the end goal of sharing the model for others to use (perhaps as a shiny app, but again, new territory for me) using the brms package in R.
I had hoped to summarize an equation that I could share, however due to the apparently complex relationship between the model supplied estimates and predictors, I realized it would probably be easier to just share the model in question.
My new issue is that I cannot just share the model as it is built on confidential data.
After reading a number of topics on this site, I saw that you should be able to use
sample_prior = "only" and then use
posterior_predict to get the simulated data, but when I do this, the values returned are all ‘-Inf’ values. Here is my code for the model below:
prior1 <- prior(normal(0, 100), nlpar = "b1", lb = 0) + prior(normal(0, 10), nlpar = "b2", lb = 0) fit <- brm(bf(y~ b1^b2, b1 ~ 1 + x b2 ~ 1, nl = TRUE), data = data, prior = prior1, iter = 54000, warmup = 22000, thin = 54, cores = 4, family = lognormal(), control = list(adapt_delta = 0.99, max_treedepth = 12), file = "fit", sample_prior = "only", save_all_pars = T, seed = 1234) str(posterior_predict(fit))
I get these results:
num [1:2372, 1:2619] 27 84 116.8 168 98.9 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : NULL
> vals <- (posterior_predict(fit)) > vals[]  Inf
Unfortunately I cannot share the underlying data here either.
I would be grateful for any advice or insight at all. Ideally a solution would not involve redoing the model, if possible (but understand it may just have to be if I’ve done something incorrectly).