#################################################
#### Run the model on simulated data
#################################################
#### Generate the covariates and response data
observations <- 100
X <- matrix(rnorm(2 * observations), ncol = 2)
colnames(X) <- c("x1", "x2")
beta <- c(2, -2, 2)
logit <- cbind(rep(1, observations), X) %*% beta
prob <- exp(logit) / (1 + exp(logit))
trials <- rep(50, observations)
Y <- rbinom(n = observations, size = trials, prob = prob)
data <- data.frame(cbind(Y, X))
#### Run the model
formula <- Y ~ x1 + x2
if (FALSE) model <- uni(formula = formula, data = data, family="binomial",
trials = trials, numberOfSamples = 10000,
burnin = 10000, thin = 10, seed = 1)
Run the code above in your browser using DataLab