Bayesian-DM-code-examples
Bayesian-DM-code-examples copied to clipboard
The problem of binomial distribution modeling
Hi, excuse me. I have met some problems in learning spatio-temporal modeling by INLA. My data includes year, the total number of trials(N), number of successes, number of failures, rate of success, longitude, latitude, and independent variable (water). as shown in the following figure.

I want to predict the rate of success in each region, Here is my code, but occured an error.
## Formula
myformula <- cbind(success,failure) ~ -1+Intercept+water
f(spatial.field,
model = myspde,
group = spatial.field.group,
control.group = list(model = "ar1",
hyper = myrho_hyper))
myoutput<-inla(myformula,
data=inla.stack.data(mystack,spde=myspde,
family="binomial(link=logit)"),
control.predictor = list(A=inla.stack.A(mystack),
compute=TRUE))
##Error in inla(myformula, data = inla.stack.data(mystack, spde = myspde, : dim(y...orig)[2] == 1 is not TRUE In addition, I'm confused that you just use count as the dependent variable, does that satisfy the binomial distribution? Looking forward to your reply. Thank you! sincerely, Sue