Questions tagged [brms]
97 questions
1
vote
0 answers
mean in Bayesian formula for non-linear modeling with brms
I am trying to fit non-linear models with brms. My model is:
y = intercept + b1 * (x1 * mean(x2^b2))
where:
x1 is a measured continuous variable,
x2 is also a continuous variable nested in x1. For more context, x1 is a population size and x2 is…

Julien Beaulieu
- 29
- 7
1
vote
1 answer
rstan/brms cause R and RStudio session abort
I am experiencing a very similar issue as rstan and brms cause R and RStudio session abort. Whenever it starts sampling, R crashes (R session abort).
I have tried reinstalling rstan along the suggested dependencies, but it has not worked.
Would you…

Raphus
- 57
- 7
1
vote
0 answers
How to fit Bayesian generalised additive models with R and Stan
Background
When fitting generalised additive models (GAMs) in the past, I have used methods for the mgcv package outlined in
Pedersen EJ, Miller DL, Simpson GL, Ross N (2019) Hierarchical generalized additive models in ecology: an introduction with…

Luka Seamus Wright
- 75
- 6
1
vote
1 answer
Is there a way to avoid this error when downloading and using brms package in R?
My code (just trying to run the example brms model) results in two errors. The first error looks like this:
require('brms')
require('rstan')
example(stan_model, package = "rstan", run.dontrun = TRUE)
but I'm left with a very long output/error that…

Ben Lee
- 35
- 5
1
vote
1 answer
Extract the "model comparisons" table from a loolist object
I would like to extract the "Model comparisons" table as a dataframe/matrix from a loolist object.
data(iris)
m1 <- brm(Sepal.Length~Sepal.Width,data=iris)
m2 <- brm(Sepal.Length~Sepal.Width + Petal.Length,data=iris)
looLst <-…

Ben Carlson
- 1,053
- 2
- 10
- 18
1
vote
0 answers
Multivariate Logistic Regression with brms
I am a new user of brms and I am exploring the way to conduct multivariate logistic regression with brms. I have six binary response variables and five predictors, one is continuous, one is ordinal, and three others are binary. Based on my…

some
- 67
- 4
1
vote
1 answer
Extract variable names from string of regression formula
Context - I have a custom function (for workflow control reasons) that wraps a regression (in this case, using brms, but I don't think the question is specific to that). Something like this:
model_predict <- function(.data, dep_var, model, )…

TY Lim
- 509
- 1
- 3
- 11
1
vote
0 answers
Specifying a conditional prior in brms or STAN
I would like to use the brms package (or STAN) to fit a Bayesian linear model, but am having trouble figuring out how to set the priors based on a conditional distribution. For example, lets say that I have an outcome y and a one covariate x…

John Smith
- 133
- 8
1
vote
1 answer
Type 2 errors with Bayesian models (brms)
Can anyone explain why the following model comes out as significant? I'm comparing one distribution with an exact copy of itself, but have tweaked the priors just right to get significance. I'm not sure why this can…

Peter
- 11
- 2
1
vote
0 answers
How do I set up a Generalized Additive Model in brms?
How do I set the priors for a smooth variable s() in the brms set_prior command for both the fixed effect portion and the random effect portion of a Generalized Additive Model that is incorporated in brms (a macro writer that calls STAN)?…

Michael Larsen
- 11
- 2
1
vote
0 answers
Using brms for a logistic regression when the outcome is imperfectly defined
I'm trying to use brms package to run a model where my dependent variable Y is an estimate of the latent variable (Disease=0 absent or Disease=1 present with a probability p).
I've a dataframe bd which contains a dichotomous variable Y (result of a…

Buczinski
- 41
- 4
1
vote
0 answers
create sequence of predictor values to generate posterior predictions of simultaneous change in predictors
I am trying to create a data frame using (either tidyr::expand.grid or tibble::data_frame) in order to then generate posterior predictions using the tidybayes::epred_draws function from tidybayes (akin to posterior_predict). I have three continuous…

AJ_0000
- 61
- 5
1
vote
0 answers
Posterior distribution for difference of two proportions with brms in R
I would like to produce a posterior distribution for the difference of two groups. I can do this in JAGS in R, but am hoping to move into this century and replicate this with Stan. I am using brms.
My questions are:
Have I correctly produced the…

cjdbarlow
- 65
- 1
- 5
1
vote
1 answer
R: Modeling random intercepts from lme4 or brms objects
Is there some way of directly (jointly) modeling the random intercepts estimated with lme4's lmer() or brms? For example, in the below code I fit a hierarchical model, extract the random intercepts, then model them.
One downside to this two-step…

socialscientist
- 3,759
- 5
- 23
- 58
1
vote
1 answer
how to get input from user and use it as a parameter in function r shiny?
I want to build bayesian model with brms in r shiny.
my goal is to get mean and standart devition for priors from user to use in brm function as an parameter.Firstly, I get "c( prior(normal( 5 , 5 ) ,coef= temperature ) )" by userınput and send it…

Ozgur Alptekın
- 505
- 6
- 19