Questions tagged [brms]
97 questions
6
votes
1 answer
What is the meaning of bf() in brms package when we do cumulative regression analysis?
I was trying to run a Bayesian multilevel cumulative model on ordinal data and was reading the documentation of brms online. My model looks something like
model <- brm(bf(y ~ Condition + (Condition|item) + (Condition|subject)),
…

Hanacl_
- 63
- 4
5
votes
1 answer
How to input matrix data into brms formula?
I am trying to input matrix data into the brm() function to run a signal regression. brm is from the brms package, which provides an interface to fit Bayesian models using Stan. Signal regression is when you model one covariate using another within…

Xia Zhu
- 53
- 4
4
votes
1 answer
Cannot get install of brms or rstan to compile
I have been trying to get brms/rstan to work on my system with limited luck. I have R 4.2 and am using R studio. I originally started doing this in R, because I couldn't get any Bayes packages to work in Python and I (it seems incorrectly) thought…

Beth
- 41
- 2
3
votes
2 answers
How to calculate mean absolute error for Bayesian modeling based on Leave-One-Out Cross-Validation with Brms package in R
I am fitting a Bayesian model to predict a test score using the Brms package.
I would like to know how to calculate the 'Mean Absolute Error' based on 'Leave-One-Out Cross-Validation' (LOO) using the LOO package, but I could not find any information…

user8460166
- 73
- 1
- 6
- 24
3
votes
2 answers
R, brms: saving models to file inside a function call saves the entire local environment
I'm fitting some models in R using brms. The data are from an experiment with per-word reading times, and I want to fit the same kinds of models on data from different words, so I put the code to fit the models into a function that accepts the data…

Jigsaw
- 405
- 5
- 11
3
votes
0 answers
Brms Causing R Session Aborted (R Encountered Fatal Error)
I keep getting this error when running brm function from brms package for building bayesian model.
I couldnt find what causes this error
Anyone have any suggestions on how to solve this? Thanks a lot for help!

Ozgur Alptekın
- 505
- 6
- 19
3
votes
3 answers
mgcv GAM: more than one variable in `by` argument (smooth varying by more than 1 factor)
I need to model a smooth term over more than one factor. The by argument allows me to model one smooth per factor level, but I cannot find how to do that over multiple factors.
I tried solutions akin to the following, but with no success:
data <-…

Dominique Makowski
- 1,511
- 1
- 13
- 30
2
votes
1 answer
Storing model estimates after running several models in a for loop in R
I want to get the model estimates that I am creating in my for loop and save them all in a data frame in r. First part of the code just to simulate a similar dataset to…

APP
- 25
- 4
2
votes
1 answer
brms error with new R and R studio download
I am new to posting in the stack overflow community so I am sorry if this the wrong place. I have recently downloaded the newest version of R (4.2.1.) and Rstudio (2022.07.1 Build 554). I was testing out an older previous document that knitted…

jenniferroters
- 21
- 1
2
votes
1 answer
Is there a method for converting a winmids object to a mids object?
Suppose I create 10 multiply-imputed datasets and use the (wonderful) MatchThem package in R to create weights for my exposure variable. The MatchThem package takes a mids object and converts it to an object of the class winmids.
My desired output…

Joseph Bulbulia
- 75
- 1
- 5
2
votes
2 answers
How to correctly use set_prior() in brms with values extracted from a matrix, e.g. prior(normal(priors[i,1], priors[i,2]))
I'd like to create a set of parameters for use in a brms model in R:
library(brms)
tmp <- prior(normal(10,2), nlpar = "x")
Ideally I'd like to extract the values for each prior (e.g. normal(10,2)) from an imported matrix, for example:
priors <-…

marine-ecologist
- 132
- 8
2
votes
1 answer
expose_functions from brms throws $ operator error
I was working on some code assembled by a colleague and ran into some problems with the expose_functions() function in brms. When I got the error (once I had made sure I hadn’t fat-fingered something), I started a new R session, made sure all of my…

Karl Wolfschtagg
- 425
- 2
- 10
2
votes
1 answer
Why is my Bayesian hierarchical regression (brms) failing to find an object in my model?
My data set is based on survey data of an animal. I want to run a Bayesian hierarchical model of the following form:
library(brms)
m1 <-
brm(
AWB ~ ndate * NP + Season + CarcassPres
+ (1 | NP/StandardTransect),
offset = log(Tlength),…

adkane
- 1,429
- 14
- 29
2
votes
0 answers
Rstudio crashes with brms function
I used to use brms without problems, but now Rstudio crashes.
In order to have the error messages, I use a chunk in a .Rmd file in a project, but it does not change when I do the same code outside the project and in a R file.
I installed the last…

Camchou
- 95
- 9
1
vote
0 answers
Cannot use brms in R
I have just installed R, then RStudio and RTools. I tried to install brms, though I succeeded but when I try to use it I get an error message (see below). What shouuld I do?
Compiling Stan program...
make cmd is
make -f…

RNewbie
- 15
- 6