)
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. "First.LSRP.score", "Second.LSRP.score", "BIS.11.score" and "nogo.errors" 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 (base on the Posterior Inclusion Probabilities I got):
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)
I tried to write:
data$Gender <- factor(data$Gender)
or
data$Gender <- as.factor(data$Gender)
When i'm using the function (with 'Gender'):
BLR <- bas.lm(RT.CIT.effect ~ Gender + 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)
It does not consider gender as a factor...
All help will be greatly appreciated! Imbar