Skip to main content

Questions tagged [brms]

brms is an R package interfacing stan for Bayesian analysis

Filter by
Sorted by
Tagged with
3 votes
1 answer
46 views

Calculate marginal effects for random effects model with two crossed random effects

I am trying to get effects marginal of two crossed random effects (using STAN or brms). I understand how to do it for a single random effect following McElreath's book and Kurtz's brms version of the ...
Christopher Rounds's user avatar
3 votes
0 answers
45 views

Fitting models with known and unknown nonlinear shapes in R

I am trying to fit a model for hypothesis-testing in R using mgcv. The response, Y is hypothesized to be a linear function of <...
SGE's user avatar
  • 141
0 votes
0 answers
13 views

Multivariate vs Univariate models in brms: Equivalence and computational efficacy

In R's brms package, I am analyzing multiple response variables. I understand that setting set_rescor(FALSE) in a multivariate ...
mat's user avatar
  • 613
1 vote
1 answer
37 views

Is a random intercept necessary for multivariate models?

I’m modeling height and weight as joint outcomes in a Bayesian multivariate model with brms, ...
mat's user avatar
  • 613
1 vote
0 answers
26 views

Bootstrapping spline construction

I wonder if we should bootstrap the construction of smoothing splines? I am modelling a logistic model with smoothing term in brms (and mgcv). When performing Bootstrap, a normal replaced resampling ...
Trinh Dong's user avatar
0 votes
0 answers
33 views

Extracting continuous effects from a brms model after weighting using the marginaleffects package - avg_slopes() or slopes()?

I'd like to estimate the causal effect of the continuous variable perc_quality_plus_palms on the number of counts of different bird species for each combination of Forest.dependency (3 categories) and ...
guest's user avatar
  • 31
4 votes
1 answer
88 views

Priors in brms are not working as I expect

I'm new to Bayesian Statistics, and I'm trying to fit a simple Linear Regression using brms and setting priors manually to each parameter, but it does not work as I ...
N R's user avatar
  • 43
2 votes
1 answer
53 views

Inflated fixed effects in mixed-effects logistic regression model

I have a dataset with multiple observations per ID and a binary outcome. I am trying to fit a mixed-effects logistic regression, however, the fixed effect estimate of the intercept is extremely large ...
Jinglestar's user avatar
0 votes
0 answers
7 views

Sparse adjacency matrix for CAR in brms?

I want to fit a model in the R package brms. My data consists of spatial polygons and I want to use conditional autoregression to account for autocorrelation. This is possible in brms but requires a ...
JonJup's user avatar
  • 119
0 votes
0 answers
20 views

Is forcing correlation between parameter values allowed in bayesian regression

I am using bayesian nonlinear regression in brms to fit some model parameters, and I'm running into some issues getting MCMC chains to converge. I know this is ...
Jacob Weverka's user avatar
0 votes
0 answers
11 views

Fitting nonlinear Bayesian regression with a summation term in brms

I'm trying to fit parameters for a Holling type II curve for multiple prey items. This takes the form: $$ \frac{dP_i}{dt} = \frac{a_iP_i}{1 +\sum_j{a_jh_jP_j}} $$ where $P_i$ is density of prey ...
Jacob Weverka's user avatar
0 votes
0 answers
19 views

Bayesian model missing outliers at cutoff in data

I am having trouble getting the model to fit. I have ED50 values of chlorophyll in corals during a heating experiment. I have 4 reef sites and 4 species of coral with ~14 corals per site-species group....
Michael's user avatar
  • 11
0 votes
0 answers
46 views

2-way interaction with emtrends or emmeans for a continues and categorical variable

I have a dataset with a continuous outcome variable (curiosity) and three independent variables: age and accuracy (both categorical with two levels), and confidence that has a linear and quadratic ...
Ali's user avatar
  • 1
1 vote
1 answer
32 views

Propagating measurement uncertainty with posterior predictions as data in another model

I'm working on a modeling approach that incorporated estimates of measurement uncertainty trying to use brms in R. I'm working from the example in chapter 14 of ...
Jacob Weverka's user avatar
1 vote
0 answers
38 views

Multilevel model where skew of random effect depends on an independent variable

I am trying to construct a model where the skew of the distribution of a random effect changes with an independent variable. I'd eventually like to fit this using ...
Jacob Weverka's user avatar
2 votes
1 answer
46 views

Is it okay to have two separate interactions with the same variable in one model?

My main model is this: ...
Olivia's user avatar
  • 375
1 vote
1 answer
47 views

How to plot posterior marginal means for categorical variables?

I ran this model. Each categorical variable has three levels. How can I plot the results such as posterior marginal means for each six levels by country? ...
Olivia's user avatar
  • 375
0 votes
0 answers
72 views

How to use posterior predictions from one model (standard curve) as an outcome variable in another model?

I'm working with a dataset concerning the concentration of a large number of different chemical compounds in a mixture, using a Bayesian approach (with brms in R). The instrument that measures the ...
Jacob Weverka's user avatar
4 votes
3 answers
141 views

How to fit a Bayesian model to a mixture of Beta and One-Zero inflated data?

I have very noisy data, which I believe is created through interactions of multiple physical processes. In the mapping $Y = f(X),$ $Y$ is a ratio $[0, 1]$ and $X \ge 0.$ While $Y$ is a function of $X,$...
PPR's user avatar
  • 145
0 votes
0 answers
87 views

post-hoc test for multinomial logistic regression brm model (categorical response)

I apologise as I am very new to this package and I really appreciate any help I can get. I have a brms model with a categorical response variable (Species) with the ...
user avatar
3 votes
1 answer
94 views

The default covariance structure implicitly assumed in the brms formula

Background: The brms official page provides the following example code to illustrate the usage of the package: ...
Hirofumi Shiba's user avatar
0 votes
0 answers
20 views

Estimating markov transition matrix using total elevator "ups" and "downs" by floor

I have data on elevator presses and I am hoping to use them to estimate a Markov transition matrix, so I can ultimately estimate how frequently people go to different floors. For each floor from 1-4, ...
Jon Spring's user avatar
1 vote
0 answers
32 views

Inconsistent posterior from hierarchical survival model

I asked about this question on Stan forum but no one replied so dual posting here. I'd really appreciate some insight, as I'm completely stuck. I’m trying to do hierarchical survival modeling using ...
Ville's user avatar
  • 81
3 votes
1 answer
91 views

Calculating contrasts of marginal effects with marginaleffects for brms model

I have fitted a logistic model with brms and want to calculate the average marginal effects (AMEs). ...
Tester01's user avatar
0 votes
1 answer
53 views

Interaction: Posterior comparison brms, difference between as_draws, and posterior_predict. Is it correct to interpret posterior_predict instead?

I have an interaction effect in my model, and I want to extract the posterior of each of my parameter in order to compare them and make inference about them. I couldn't simply use the as_draws() ...
Guillaume Pech's user avatar
0 votes
0 answers
32 views

Likert scale study - ordinal regression model

My linguistics rating experiment contains 36 stimuli in total for rating. There are 6 themes (e.g. doctor, farm, etc), and each theme has 3 conditions (good, bad, mixed), and each condition has 2 ...
user avatar
4 votes
1 answer
552 views

Setting priors for categorical variables in bayesian multilevel model analysis with BRMS package (repost)

I am reposting the same question that I made on Stack Overflow. I am new with Bayesian analysis methods and I am still struggling understanding some concepts regarding priors. I am running a model ...
Dea's user avatar
  • 41
0 votes
0 answers
26 views

Include error on the predictor from mean and asymetric credible interval

I am doing non-linear models with brms. My model is : ...
user avatar
0 votes
0 answers
24 views

How to select a proper prior to control the time dependent structure of variable?

I am new in analyzing RCT data and not familiar with the techniques that are always used in RCT analysis. I am analyzing a dataset of a study: An RCT study with 50 participants; the data was collected ...
doraemon's user avatar
  • 364
0 votes
0 answers
42 views

Results dirichlet regression - brms vs DirichelReg comparison

I am new to Dirichlet regression, but I am trying to understand why model outputs are potentially different when I use two different R packages, and how I could interpret the slope and intercept ...
Vale's user avatar
  • 1
3 votes
1 answer
276 views

Bayesian linear regression: How to enforce constraint on the sum of coefficients?

I have a linear regression problem in which my $X$ matrix is not full rank. Here is a small example: $$X = \left[\begin{array}{rrrr} -1 & 0 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 &...
ischmidt20's user avatar
1 vote
0 answers
69 views

How to improve bayesian logistic regression model with priors

I'm trying to fit a bayesian logistic regression model to calculate the expected goals (xG) of certain shootings data in football. My model has some simple features where I first fit a model with ...
Quinten's user avatar
  • 389
1 vote
0 answers
32 views

Is it possible to estimate effects using Bayesian modelling after matching?

I am following [Greifer 2023][1] to estimate the effect size after (genetic) matching, where I am using bootstrapping to estimate the confidence intervals. Since I have a hierarchical setup with ...
guest1927's user avatar
0 votes
1 answer
238 views

Interpreting Coefficients of brms Bernoulli family model

I am struggling with interpreting model results from a brm() model. The first result uses scaled and centered data with command scale(df$column, scale = TRUE, center = TRUE). ...
user avatar
2 votes
1 answer
294 views

How to Compute Mean Ratios and Their 95% Confidence Intervals in a Bayesian Model

I am working on a Bayesian model using the brm function from the brms package in R, and I am interested in comparing mean responses of different groups. Specifically, I would like to calculate the ...
mat's user avatar
  • 613
1 vote
0 answers
40 views

Proper analysis of completely crossed design with subjects and items as random effects (brms)

I have the following study design: stimuli: 240 pictures: 6 pictures of 40 students each (each student fixated one of six points and during each fixation one picture was taken) each stimulus was ...
Coconutts's user avatar
1 vote
1 answer
197 views

Calculating percentage change from emmeans

A related question was asked on this thread How to calculate percentage difference of geometric means with emmeans?, but I still need some help. Instead of calculating the absolute difference between ...
mrmic1's user avatar
  • 11
1 vote
2 answers
32 views

Incorporating neighboring years in multilevel model, estimated in Stan using brms

I am estimating a multilevel model in Stan, using the brms package. Specifically, I am estimating a model of the following form: m1 <- brm(y ~ 1 + (1 | year)) ...
user2018396's user avatar
4 votes
1 answer
154 views

Is it possible to use smooth functions as part of a nonlinear regression?

Background I am fitting nonlinear regressions with a single response and two predictors. I know the relationship between the response and each of the predictors, but I do not know how they interact. I ...
mkt's user avatar
  • 20.4k
1 vote
1 answer
55 views

Why do you always need to interact the covariates with the slope in mutlilevel models?

On a number of occassions, I have seen people remark that you should always interact your covariates with the with your slope when running multilevel models. That is, for example, you should not run ...
statslearner13's user avatar
1 vote
0 answers
34 views

Sourcing Informative Priors from an already conducted Empirical Study in brms package in R

I am conducting two studies (with 15 participants) and my study is based on two already conducted studies with a very similar objective and method. One of the studies contain only the results, and one ...
Deepshikha Prasad's user avatar
0 votes
1 answer
36 views

Access to the interaction of two three level factors on a mixed model

Using a mixed model (either frequentist lmer or bayesian brms) I have an issue regarding an interaction in my model. I have two factor variable of three level : condition (0-1-2) and Tps_real (0-300-...
Guillaume Pech's user avatar
1 vote
0 answers
104 views

Bounded uniform prior in R

I have been fitting a bayesian GLM using brms. The code works well but when I loop this over several data and make it a bit more complex, R encounters a fatal error and crashes. This seems to be ...
blackandwhite's user avatar
0 votes
1 answer
83 views

Non-linear formulas in mgcv

in brms (which is heavily based on mgcv) there is a possibility to define non-linear formulas (meaning not linear in parameters). However, for different reasons I need to use mgcv. E.g. the model <...
Niklas's user avatar
  • 1
1 vote
0 answers
40 views

Measuring uncertainty in edge weights using Bayesian modeling and brms in R

I'm interested in using Bayesian models to measure uncertainty in edge weights within social networks. Specifically, I have been trying to replicate how this package works but using brms: https://...
Peej's user avatar
  • 11
2 votes
1 answer
603 views

brms model specification with 3 (crossed or nested?) levels

I have a data set that looks like this toy data ...
lilla's user avatar
  • 43
2 votes
1 answer
416 views

Is it possible to specify a nested autocorrelation term when working with a hierarchical structure (GAM)?

I am modelling the occurrence of a species at 5 different sites on an hourly basis (presence/absence), based on a range of temporal predictors (e.g. time of the year, day/night cycle, tides ...). ...
Timelate's user avatar
  • 309
0 votes
1 answer
64 views

Title: How to fit a Frequentist Equivalent of Bayesian mixed-effects model with nlme or lme4 and obtain category-specific variances and intercepts?

I am interested in fitting a Bayesian mixed-effects model to my data using the brms package. My data includes three grouping variables (Category, BioRep, and TechRep), and I want to estimate category-...
Dermot Harnett's user avatar
1 vote
0 answers
132 views

bayesian problem using inverse gamma: negative initial values

My study involves a dependent variable measuring reading times (minimum value = 0.3) and two categorical variables (y = "quick" or "slow"; t = "cute" or "ugly") ...
Olivia's user avatar
  • 375
5 votes
1 answer
1k views

How to interpret elpd_diff of Bayesian LOO estimate in Bayesian Logistic Regression

I have conducted a Bayesian Logistic regression, and I would like to compare 2 models : one model with one continuous predictor (M1) and one model without predictor (M0). The outcome is a binary ...
user381165's user avatar