#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Adding a factor to a Bayesian Regression

Hi everyone,

I'm interested in conducting a Bayesian regression analysis. I have various continuous predictors, which I can add as "Covariates". However, I would also like to add Gender, which should be a factor if I'm correct (its a nominal variable). In the regular regression I can do, but not in the Bayesian regression.

Hence, I started programming it in R. However, also here did not succeed to add Gender as a factor haha. I hope someone can help :).

I used the 'bas.lm' function to analyze the posterior probabilities. The Italic items are "covariates"...

BLR <- bas.lm(RT.CIT.effect ~ First.LSRP.score + Second.LSRP.score + BIS.11.score + nogo.errors, data = data, prior = "JZS", modelprior = beta.binomial(1,1), method = "BAS", alpha = 0.125316)

And this is what I wrote to calculate the BF inclusion

pip_vector <- c(0.1729, 0.1547, 0.2247, 0.2250)

prior_odds_inclusion <- 1

prior_odds_exclusion <- 1

bf_inclusion <- pip_vector / (1 - pip_vector) * (prior_odds_inclusion / prior_odds_exclusion)

All help will be greatly appreciated!

Nathalie

• Hi Nathalie,

The issue is that the prior structure on the regression coefficients is of a particular form that assumes the predictors are continuous. Making the methodology work for all kinds of predictors would be very interesting. I would be tempted to pretend that "gender" was a continuous predictor, but that is a hacky solution.

EJ

• Thank you EJ!

So, maybe it will be more correct to run a Bayesian ANCOVA?

I can add the continuous variables as covariates, and Gender as a fixed factor (this I can do in JASP). Im just confused with the term "covariate", as in ANCOVA we usually want to control for the Covariate...

Thank you, all help is very much appreciated! :)

Nathalie

• Yes, that is correct

EJ