Skip to content

The problem of binomial distribution modeling #1

@sue-shine

Description

@sue-shine

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions