Hello everyone,
I fitted a GLMM model on count data of the number of fruits produced by açaí palms in the Amazon using the glmmTMB package. The model is negative binomial with zero inflation, a random structure that controls for repeated measurements on the same palms in 2 consecutive years ("number" variable) and a spatial structure of nested plots within transects within blocks. The fixed part contains the year of measurement "ano_medida", the soil height diameter of each plant das_mm and other variables linked to the hydrology and forest structure of each plot. The variables in the fixed part were z-standardized to stabilize the model and deal with overdispersion. The model was able to deal with an overdispersion problem and a high proportion of structural zeros. The selection was made first for the zero-inflation part and then for the conditional part. I would like to graphically illustrate the relationship of the non zero inflated part between n_fruits and das_mm conditional on the results found in the model. I tried to do this using the visreg function but I get a repeated error: > visreg(modelo16_REML, "das_mm", type = "contrast", data = dados_transformados) Error in eval(predvars, data, env) : objeto 'dif_alt_dossel_m' não encontrado I tried to apply a solution I found in the visreg FAQ, but it didn't work: fit$gam does not include the call (i.e., fit$gam$call is NULL), which means visreg won’t be able to find the data: visreg <https://pbreheny.github.io/visreg/reference/visreg.html>(fit$gam, 'x') # Error in FUN(X[[i]], ...): object 'y' not found So you have to include it manually: fit$gam$data <- Data visreg <https://pbreheny.github.io/visreg/reference/visreg.html>(fit$gam, 'x') modelo16_REML$data = dados_transformados However visreg did not work in this way also. Can anyone tell me how to illustrate this relationship? I'm only referring to the conditional part of the model, because I'm not going to illustrate the zeros inflation part, it was only used to control the zeros inflation part and it was illustrated separately through a logistic model, for which visreg worked well. Thanks in advance for any ideas, Alexandre modelo16_REML <- glmmTMB(n_frutos ~ ano_medida + das_mm + (1|numero) + (1|bloco/transecto/parcela), ziformula = ~ ano_medida + das_mm + dif_alt_dossel_m + elevation_m + hand_m + basal_area_m2 + tree_density + das_mm:dif_alt_dossel_m + elevation_m:hand_m + (1|numero) + (1|bloco/transecto/parcela), family = nbinom1, data = dados_transformados, REML=TRUE) > summary(modelo16_REML) Family: nbinom1 ( log ) Formula: n_frutos ~ ano_medida + das_mm + (1 | numero) + (1 | bloco/transecto/parcela) Zero inflation: ~ano_medida + das_mm + dif_alt_dossel_m + elevation_m + hand_m + basal_area_m2 + tree_density + das_mm:dif_alt_dossel_m + elevation_m:hand_m + (1 | numero) + (1 | bloco/transecto/parcela) Data: dados_transformados AIC BIC logLik deviance df.resid 22121.3 22255.7 -11036.7 22073.3 1975 Random effects: Conditional model: Groups Name Variance Std.Dev. numero (Intercept) 0.019859 0.14092 parcela:transecto:bloco (Intercept) 0.006741 0.08211 transecto:bloco (Intercept) 0.015453 0.12431 bloco (Intercept) 0.020497 0.14317 Number of obs: 1995, groups: numero, 761; parcela:transecto:bloco, 146; transecto:bloco, 39; bloco, 10 Zero-inflation model: Groups Name Variance Std.Dev. numero (Intercept) 1.323e+00 1.1500780 parcela:transecto:bloco (Intercept) 4.588e-01 0.6773243 transecto:bloco (Intercept) 9.890e-07 0.0009945 bloco (Intercept) 1.970e-01 0.4438035 Number of obs: 1995, groups: numero, 761; parcela:transecto:bloco, 146; transecto:bloco, 39; bloco, 10 Dispersion parameter for nbinom1 family (): 598 Conditional model: Estimate Std. Error z value Pr(>|z|) (Intercept) 8.61419 0.05588 154.16 < 2e-16 *** ano_medida2017 -0.32062 0.02686 -11.94 < 2e-16 *** ano_medida2018 -0.47854 0.02501 -19.13 < 2e-16 *** das_mm 0.08344 0.01869 4.46 8.04e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Zero-inflation model: Estimate Std. Error z value Pr(>|z|) (Intercept) -0.97345 0.22911 -4.249 2.15e-05 *** ano_medida2017 1.82993 0.18150 10.082 < 2e-16 *** ano_medida2018 -0.01319 0.17647 -0.075 0.9404 das_mm -1.24866 0.13190 -9.467 < 2e-16 *** dif_alt_dossel_m -1.30749 0.14970 -8.734 < 2e-16 *** elevation_m 0.27767 0.17206 1.614 0.1066 hand_m -0.20645 0.15959 -1.294 0.1958 basal_area_m2 -0.71171 0.14941 -4.763 1.90e-06 *** tree_density 0.33322 0.15064 2.212 0.0270 * das_mm:dif_alt_dossel_m 0.55660 0.12694 4.385 1.16e-05 *** elevation_m:hand_m -0.33424 0.13648 -2.449 0.0143 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -- Dr. Alexandre F. Souza Professor Associado Departamento de Ecologia/CB Universidade Federal do Rio Grande do Norte Campus Universitário - Lagoa Nova 59072-970 - Natal, RN - Brasil lattes: lattes.cnpq.br/7844758818522706 http://www.esferacientifica.com.br https://www.youtube.com/user/alexfadigas http://www.docente.ufrn.br/alexsouza orcid.org/0000-0001-7468-3631 <http://www.docente.ufrn.br/alexsouza> [[alternative HTML version deleted]] _______________________________________________ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology