Simple Slopes analysis with glmmTMB model

74 Views Asked by At

I fit a model with glmmTMB. I have a significant interaction between continuous variables. But "sim_slopes" from the "interactions" library cannot perform the analysis. There were some alternatives, like the one found in the "reghelper" library (simple_slopes), but they didn't work either.

Model:

library(glmmTMB)
m.tot<-glmmTMB(AbundanciaTotal~PCA1*PCA2*PCA3+ar1(tiempo+0|arbol), 
         family = nbinom2(link = "log"),data = datos)

AbundanciaTotal is a count-type variable with a negative binomial distribution. PCA 1, 2 and 3 are axes extracted from a PCA that summarizes several continuous explanatory variables.

Random effects:
 Groups Name        Variance  Std.Dev. 
 arbol  (Intercept) 1.456e-09 3.815e-05
Number of obs: 59, groups:  arbol, 10

Fixed effects:
               Estimate Std. Error z value Pr(>|z|)    
(Intercept)     5.63610    0.04451 126.613  < 2e-16 ***
PCA1            0.04644    0.01968   2.360  0.01828 *  
PCA2           -0.11618    0.03584  -3.242  0.00119 ** 
PCA3           -0.13619    0.04711  -2.891  0.00384 ** 
PCA1:PCA2      -0.02106    0.01584  -1.330  0.18359    
PCA1:PCA3       0.07522    0.01924   3.910 9.22e-05 ***
PCA2:PCA3       0.05129    0.03646   1.407  0.15950    
PCA1:PCA2:PCA3  0.03939    0.02240   1.758  0.07868 .

When I try to do the analysis the following happens:

> library(interactions)
> sim_slopes(m.tot, pred = PCA1, modx = PCA3)
Error in if (tcol == "df") tcol <- "t val." : argument is of length zero

The idea is to do the simple slope test between PCA1 and PCA3. How could I do it?

0

There are 0 best solutions below