-2

I want to fit a mixed model to look at between regions variation in disease cases with first level being at postcode and second level as region using poisson regression with covariates being max temp, mean temp, min temp. I have 3 regions coded as Region.Coding. Any help to start with using variable using data frame bellow:

Postcode    Region.Coding   maxtemp meantemp    mintemp Cases2011
YO7 4DH     1               13.45   9.75        6.05    50
YO62 7JL    1               13.45   9.75        6.05    0
YO62 6RW    1               13.45   9.75        6.05    10
YO62 5HX    1               13.45   9.75        6.05    0
TN27 0DA    2               15.32   11.22       7.13    98
TN26 3TF    2               15.32   11.22       7.13    0
TN26 3EU    2               15.32   11.22       7.13    30
TN25 6AS    2               15.32   11.22       7.13    0
TN25 5PD    2               15.32   11.22       7.13    28
TR7 3HU     3               14.17   10.6        7.06    115
TR27 5EF    3               14.17   10.6        7.06    0
TR10 9DL    3               14.17   10.6        7.06    0
TQ9 7LN     3               14.17   10.6        7.06    23
TQ9 6NQ     3              14.17    10.6        7.06    50
Joshua Onyango
  • 35
  • 4
  • 12

1 Answers1

1

Something like:

library(lme4)
glmer(Cases2011 ~ maxtemp+mintemp+meantemp + (1|Region.Coding/PostCode),
      family=poisson, data=mydata)

... however, I wouldn't recommend fitting a categorical variable with only three levels (Region.Coding) as random, so try

glmer(Cases2011 ~ maxtemp+mintemp+meantemp + Region.Coding +
       (1|PostCode),
      family=poisson, data=mydata)

assuming that post codes are unique (i.e, the same postcode doesn't occur in two different regions).

Don't forget to check for overdispersion!

Depending on how much data you have, you might want to allow for interactions between the temperature variables and your regions (e.g. mintemp:Region.Coding or (mintemp|PostCode).

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • Thanks@Ben Bolker. Would you mind suggesting other approaches to geting to find out if variables could be predictors for Cases2011 per region. One of the approach would be this though this cant work due to variables having only one value per region ##Regional Analysis orf1=subset(orf,Region.Coding==1) orf2=subset(orf,Region.Coding==2) orf3=subset(orf,Region.Coding==3) reg1<-glm(Cases2011~maxtemp+mintemp+meantemp,family=poisson, data=orf1) – Joshua Onyango Dec 18 '15 at 23:55
  • you should probably post a follow-up question to [CrossValidated](http://stats.stackexchange.com) ... I don't know what you mean by "find out if variables could predictors for Cases per region". – Ben Bolker Dec 19 '15 at 00:10