Bayesian-DM-code-examples icon indicating copy to clipboard operation
Bayesian-DM-code-examples copied to clipboard

The problem of binomial distribution modeling

Open sue-shine opened this issue 4 years ago • 0 comments

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.

屏幕截图 2021-06-12 124111

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

sue-shine avatar Jun 12 '21 06:06 sue-shine