Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: PB p-values for a poisson glmm with an offset? #162
    CMac
    Participant

    Thanks Henrik. I will just be more patient then 🙂
    I was just concerned because I am running some lmers on the same dataset (different response variables) with mixed using method=”PB” and they only take a few minutes to run, compared with the hours in which the glmer had not completed its calculations. The dataset is not that big, only 144 samples.

    Thank you very much for your help and explanations!

    in reply to: PB p-values for a poisson glmm with an offset? #157
    CMac
    Participant

    Whoops, sorry, whilst creating the example data I identified the cause of the ‘type builtin not subsettable’ was related to my rookie mistake naming my dataframe ‘exp’ (doh!).

    However things still don’t seem right: the mixed function now runs, but is taking an extremely long time to run compared with glmer, and hasn’t completed calculating P-values after several hours on my full dataset. It also produces a lot of non-convergence warnings.

    Here’s an example data subset and code. The mixed function does eventually complete calculations on this data, but still comes up with the non-convergence warnings. It would be great if you could let me know if it’s working as expected or not. I hope I haven’t done anything else silly (I have checked everything I can think of). Thanks very much!!

    #R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
    #packages
    library(lme4)
    library(afex)
    #example data
    zz<-"factor1 factor2 subject abundance max
    A a 1 659 658
    A a 2 1408 1407
    A b 1 826 789
    A b 2 1348 1271
    B a 3 242 242
    B a 4 487 480
    B b 3 605 585
    B b 4 618 599
    C a 5 382 346
    C a 6 613 598
    C b 5 370 336
    C b 6 1002 963"
    df <- read.table(text=zz, header = TRUE)
    #factors
    df$factor1<-as.factor(df$factor1)
    df$factor2<-as.factor(df$factor2)
    df$subject<-as.factor(df$subject)
    #create index variable
    df$index<-df$max/df$abundance
    #lme4::glmer
    mod1<-glmer((index*abundance)~factor1*factor2+(1|subject), data=df, 
                  family=poisson(link="log"), offset=(log(df$abundance)))
    #afex::mixed
    mod2<-mixed((index*abundance)~factor1*factor2+(1|subject), data=df, 
                 family=poisson(link="log"), offset=(log(df$abundance)), method="PB")
    • This reply was modified 2 years, 5 months ago by henrik. Reason: nicer formatting of code
Viewing 2 posts - 1 through 2 (of 2 total)