[R-sig-ME] nplmreg and overdispersed distributions

David Duffy davidD at qimr.edu.au
Tue Jun 29 09:11:41 CEST 2010


On Fri, 25 Jun 2010, David Atkins wrote:

>
>> summary(drk.glmer)
> Generalized linear mixed model fit by the Laplace approximation
> Formula: drinks ~ weekday * gender + (1 | id) + (1 | over)
>   Data: drink.df
>   AIC   BIC logLik deviance
> 73662 73805 -36815    73630
> Random effects:
> Groups Name        Variance  Std.Dev.
> over   (Intercept) 18.953746 4.35359
> id     (Intercept)  0.035047 0.18721
> Number of obs: 56199, groups: over, 56199; id, 980
>
> Fixed effects:
>                         Estimate Std. Error z value Pr(>|z|)
> (Intercept)              -5.44079    0.15315  -35.53  < 2e-16 ***
> weekdayMonday            -0.10165    0.22164   -0.46  0.64651
> weekdayTuesday           -0.02491    0.21837   -0.11  0.90919
> weekdayWednesday         -0.07211    0.22089   -0.33  0.74408
> weekdayThursday           0.51327    0.19953    2.57  0.01010 *
> weekdayFriday             1.65032    0.17918    9.21  < 2e-16 ***
> weekdaySaturday           1.51045    0.18023    8.38  < 2e-16 ***
> genderM                   0.13300    0.22493    0.59  0.55432
> weekdayMonday:genderM     0.43511    0.31295    1.39  0.16442
> weekdayTuesday:genderM    0.35643    0.31078    1.15  0.25142
> weekdayWednesday:genderM  0.38299    0.31327    1.22  0.22150
> weekdayThursday:genderM   0.60046    0.28439    2.11  0.03474 *
> weekdayFriday:genderM     1.26700    0.25845    4.90 9.48e-07 ***
> weekdaySaturday:genderM   0.79712    0.26107    3.05  0.00226 **
> ---
>

I played around using the nplmreg package for these data:

x <- read.table("atkinsdrinking.dat",h=T)
x$id <- factor(x$id)
x$weekday <- factor(x$weekday)
library(npmlreg)
w1 <- allvc(drinks ~ weekday * gender, random=~1|id,
             data=x, k=3, family=poisson())
w2 <- allvc(drinks ~ weekday * gender, random=~1|id,
             data=x, k=4, family=poisson())
w3 <- allvc(drinks ~ weekday * gender, random=~1|id,
           data=x, k=5, family=poisson())


summary(w3)

Call:  allvc(formula = drinks ~ weekday * gender, random = ~1 | id, 
family = poisson(), data = x, k = 5)

Coefficients:
                     Estimate Std. Error     t value
weekday2         -0.01078244 0.03327762  -0.3240146
weekday3          0.02648464 0.03300293   0.8024937
weekday4         -0.01053878 0.03337888  -0.3157319
weekday5          0.50105222 0.02972589  16.8557542
weekday6          1.12753214 0.02687809  41.9498558
weekday7          1.06078775 0.02706839  39.1891739
genderM           0.37350999 0.03174335  11.7665577
weekday2:genderM  0.36926108 0.04355992   8.4770837
weekday3:genderM  0.29559643 0.04353879   6.7892661
weekday4:genderM  0.36289380 0.04373133   8.2982575
weekday5:genderM  0.45263084 0.03909019  11.5791429
weekday6:genderM  0.40175135 0.03582774  11.2134145
weekday7:genderM  0.29630811 0.03621084   8.1828555
MASS1            -2.65406245 0.03205365 -82.8006201
MASS2            -1.58730489 0.02522484 -62.9262717
MASS3            -0.83696785 0.02427729 -34.4753395
MASS4            -0.20183478 0.02463629  -8.1925804
MASS5             0.42940967 0.02434547  17.6381755

Mixture proportions:
      MASS1       MASS2       MASS3       MASS4       MASS5
0.19720118  0.31780163  0.27323454  0.12845641  0.08330624

Random effect distribution - standard deviation:	   0.9206557

-2 log L:	    184333.2     Convergence at iteration  76


This is not too slow, though worsening as the number of components 
increasing (looking at the likelihoods, I might still need a few more 
components).

another 2c,

David Duffy.

-- 
| David Duffy (MBBS PhD)                                         ,-_|\
| email: davidD at qimr.edu.au  ph: INT+61+7+3362-0217 fax: -0101  /     *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v




More information about the R-sig-mixed-models mailing list