I am trying to implement Bayesian Logistic Regression in greta, but I’m stuck at defining the likelihood. Here is the code so far,
library(greta) # data summary(iris) x = within(iris, rm(Species)) y = iris$Species # prior w_mean = t(integer(5)) w_sigma = diag(5) prior = multivariate_normal(w_mean, w_sigma) # likelihood distribution(y) = # how to define logistic regression likelihood # model m = model(prior) # sampling draws <- mcmc(m, n_samples = 1000)
Because iris has 4 predictors, I have taken prior as multivariate normal distribution with 5 means(one extra for bias) and covariance as 5x5 identity matrix.
Now I need to define likelihood, which is given as mentioned here. I am confused as to how I would implement this.