Interaktion verursacht Fehlermeldung

Modelle zur Korrelations- und Regressionsanalyse

Moderator: EDi

Antworten
FledermausR
Beiträge: 21
Registriert: Fr Mär 23, 2018 11:24 am

Interaktion verursacht Fehlermeldung

Beitrag von FledermausR »

Hallo,
ich habe mit dem lme4 package ein gemixtes Modell erstellt.
FA= numerisch (Flugaktivität)
treatment=faktoriell
To=numerisch (Außentemperatur)
week=integer (ID der Untersuchungswoche)
bunker=faktoriell (8 Bunker)

Code: Alles auswählen

m1<-glmer(FA~treatment * To +week +(1|bunker) , data=model,family="poisson", na.action=na.exclude)
Bis hier hin ist auch alles gut. Wenn ich aber die Interaktion (To:week) einfüge, dann bekomme ich folgende Fehlermeldung

Code: Alles auswählen

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.00144043 (tol = 0.001, component 1)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?
Verstehe aber nicht warum. Wie sollte ich die Variablen anders skalieren?
Der Modeloutput:

Code: Alles auswählen

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: poisson  ( log )
Formula: FA ~ treatment * To + week + (To:week) + (1 | bunker)
   Data: model

     AIC      BIC   logLik deviance df.resid 
  1363.8   1384.4   -674.9   1349.8      133 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.7898 -1.7585 -0.3913  1.2428 11.1604 

Random effects:
 Groups Name        Variance Std.Dev.
 bunker (Intercept) 0.07295  0.2701  
Number of obs: 140, groups:  bunker, 8

Fixed effects:
                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)      1.7375000  0.1269460  13.687  < 2e-16 ***
treatmentmon     0.4457489  0.0589911   7.556 4.15e-14 ***
To               0.1095392  0.0194596   5.629 1.81e-08 ***
week             0.0444788  0.0123033   3.615   0.0003 ***
treatmentmon:To -0.0766273  0.0122636  -6.248 4.15e-10 ***
To:week         -0.0006522  0.0026561  -0.246   0.8060    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) trtmnt To     week   trtm:T
treatmentmn -0.317                            
To          -0.415  0.263                     
week        -0.540  0.037  0.534              
tretmntmn:T  0.126 -0.357 -0.325  0.014       
To:week      0.373 -0.091 -0.876 -0.604 -0.050
convergence code: 0
Model failed to converge with max|grad| = 0.00144043 (tol = 0.001, component 1)
Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?


Die Daten

Code: Alles auswählen

structure(list(bunker = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 
2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 
6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 
6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 
3L, 3L, 4L, 4L, 4L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 1L, 
1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 6L, 6L, 6L, 7L, 
7L, 7L, 8L, 8L, 8L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 
6L, 7L, 7L, 8L, 8L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 
6L, 7L, 7L, 8L, 8L), .Label = c("1", "2", "3", "4", "5", "6", 
"7", "8"), class = "factor"), FA = c(2, 3, 7, 33, 22, 0, 1, 19, 
10, 7, 6, 4, 5, 7, 8, 4, 23, 7, 4, 23, 25, 1, 1, 3, 8, 7, 2, 
0, 8, 1, 7, 11, 12, 1, 16, 13, 7, 27, 20, 23, 27, 11, 12, 0, 
15, 17, 10, 6, 14, 9, 11, 0, 9, 10, 4, 0, 3, 0, 5, 8, 4, 38, 
18, 32, 18, 0, 2, 2, 14, 10, 15, 5, 7, 10, 14, 0, 1, 4, 5, 1, 
0, 2, 10, 7, 12, 4, 3, 4, 0, 14, 6, 6, 15, 19, 12, 0, 3, 7, 5, 
5, 3, 6, 5, 3, 19, 9, 18, 5, 0, 2, 10, 27, 17, 6, 4, 11, 10, 
29, 0, 12, 1, 14, 1, 37, 18, 29, 8, 41, 3, 24, 14, 10, 7, 20, 
44, 11, 9, 9, 15, 8), treatment = structure(c(1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("ctrl", "mon"), class = "factor"), 
    To = c(5, 0, 0, 7, 4.5, -1.5, -1, 5, 5, 0, 0, 7, 4.5, -1.5, 
    -1, 5, 5, 0, 0, 7, 4.5, -1.5, -1, 5, 5, 0, 0, 7, 4.5, -1.5, 
    -1, 5, 4.5, -1.5, -1, 5, 3, -2, 0, 6, 4.5, -1.5, -1, 5, 3, 
    -2, 0, 6, 4.5, -1.5, -1, 5, 3, -2, 0, 6, 4.5, -1.5, -1, 5, 
    3, -2, 0, 6, 5.5, -1.5, -1, -4.4, -1.1, -3, 5.5, -1.5, -1, 
    -4.4, -1.1, -3, -1, -4.4, -1.1, -3, 5.5, -1.5, -1, -4.4, 
    -1.1, -3, -4.4, -1.1, -3, -4.7, 2.2, -2.3, -4.4, -1.1, -3, 
    -4.7, 2.2, -2.3, -3, -4.7, 2.2, -2.3, -4.4, -1.1, -3, -4.7, 
    2.2, -2.3, -9.8, 2.7, -7.6, 7.6, -9.8, 2.7, -7.6, 7.6, -9.8, 
    2.7, -7.6, 7.6, -9.8, 2.7, -7.6, 7.6, -7.6, 7.6, -4, 6.4, 
    -7.6, 7.6, -4, 6.4, -7.6, 7.6, -4, 6.4, -7.6, 7.6, -4, 6.4
    ), week = c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 
    1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 
    4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 
    3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 
    2L, 3L, 4L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 5L, 6L, 7L, 5L, 6L, 
    7L, 5L, 6L, 7L, 7L, 5L, 6L, 7L, 5L, 6L, 7L, 5L, 6L, 7L, 5L, 
    6L, 7L, 5L, 6L, 7L, 5L, 6L, 7L, 5L, 6L, 7L, 7L, 5L, 6L, 7L, 
    5L, 6L, 7L, 5L, 6L, 7L, 8L, 9L, 8L, 9L, 8L, 9L, 8L, 9L, 8L, 
    9L, 8L, 9L, 8L, 9L, 8L, 9L, 8L, 9L, 8L, 9L, 8L, 9L, 8L, 9L, 
    8L, 9L, 8L, 9L, 8L, 9L, 8L, 9L)), row.names = c(NA, -140L
), class = "data.frame")
Ich freue mich über jeden Hinweis :)
Danke
Benutzeravatar
EDi
Beiträge: 1599
Registriert: Sa Okt 08, 2016 3:39 pm

Re: Interaktion verursacht Fehlermeldung

Beitrag von EDi »

So hier?

Code: Alles auswählen

library(lme4)
ctrl <- glmerControl(optimizer = 'bobyqa')
df$To_sc <- scale(df$To, center = TRUE, scale = TRUE)       
m1<-glmer(FA ~ treatment * To_sc + week + (To_sc:week) + (1 | bunker) , data=df,family="poisson", na.action=na.exclude, control = ctrl)
m1
summary(m1)
Was das für Auswirkungen auf die Interpretation der Koeffizienten hat, überlasse ich dir als Hausaufgabe ;)
Bitte immer ein reproduzierbares Minimalbeispiel angeben. Meinungen gehören mir und geben nicht die meines Brötchengebers wieder.

Dieser Beitrag ist lizensiert unter einer CC BY 4.0 Lizenz
Bild.
FledermausR
Beiträge: 21
Registriert: Fr Mär 23, 2018 11:24 am

Re: Interaktion verursacht Fehlermeldung

Beitrag von FledermausR »

cool. Danke :)
Antworten