[R-sig-eco] avocado pollination retworks

Mariano Devoto mdevoto @ending from @gro@ub@@@r
Tue Jun 5 21:28:08 CEST 2018


Dear List,

Once again I ask for your kind advice. I am analyzing the structure of
pollination networks in conventional vs organic avocado farms.
I have four different response variables: interaction richness (a count),
interaction evenness, interaction selectivity and nestedness (all three
take values in the [0, 1] interval).
The explanatory variables are: farm type (fixed factor, 2 levels), sampling
season (fixed factor, 2 levels), and farm identity (random factor).
Additionally, the number of species in the network (a count) might affect
some of the response variables (interaction richness and nestedness
probably, although I am not sure about the other two), so I decided to
"correct" for that effect in some of the models.
I am generally familiar with models dealing with count data, but I am not
too confident modelling 0-1 bounded continuous data.
For each variable I've searched the literature and online resources to try
and find the best R function, model and error structure.

I have pasted below a workable code that deals sequentially with each
response variable.
Would you say the models correctly are defined in each case? I am
particularly concerned with (1) the suitability of the "simulateResidual"
function in the Dharma package (which I recently learned about) as a way to
check the fit of the model,
and (2) the validity of the offset term in model 4.

Your comments and suggestions will be greatly appreciated.

Best regards,

Mariano

###############################
require(RCurl); require(visreg); require(lme4); require(DHARMa);
library(lmerTest); require(glmmTMB); require(effects)
my.file <- getURL("
https://docs.google.com/spreadsheets/d/e/2PACX-1vRn3_aM-OlKldXlEB45qKjL9jMoY_-CP2saOI8HteTTx4_AZv-card1sce4MDbqwYJ8kllJUaysfcBR/pub?output=csv
")
avocado_data <- read.csv(textConnection(my.file), head=T)
str(avocado_data)

##Model for Interaction richness
model1 <- glmer(irich ~ offset(log(species)) + type + season + (1|farm),
family=poisson, data=avocado_data)
summary(model1)
#diagnostic plots
plot(model1)
simulationOutput <- simulateResiduals(fittedModel = model2, n = 1000)
testOverdispersion(simulationOutput = simulationOutput, alternative
="greater") #the data are not overdispersed relative to the Poisson
distribution
plotSimulatedResiduals(simulationOutput = simulationOutput)
visreg(model1, pch=16, cex=1.5, rug=FALSE, ylab="Interaction richness",
line.par=list(col="darkgreen"), points.par=list(col="red", cex=1.5),
overlay=TRUE)

##Model for Interaction evenness
model2 <- lmer(ieven~ type + season + (1|farm), data=avocado_data)
summary(model2)
#diagnostic plots
plot(model2)
simulationOutput <- simulateResiduals(fittedModel = model2, n = 1000)
plotSimulatedResiduals(simulationOutput = simulationOutput)
visreg(model2, pch=16, cex=1.5, rug=FALSE, ylab="Interaction evenness",
line.par=list(col="darkgreen"), points.par=list(col="red", cex=1.5),
overlay=TRUE)

##Model for Interaction selectivity
model3 <- lmer(h2 ~ type + season + (1|farm), data=avocado_data)
summary(model3)
#diagnostic plots
plot(model3)
simulationOutput <- simulateResiduals(fittedModel = model3, n = 1000)
plotSimulatedResiduals(simulationOutput = simulationOutput)
visreg(model3, pch=16, cex=2, rug=FALSE, ylab="Interaction selectivity",
line.par=list(col="darkgreen"), points.par=list(col="red", cex=1.5),
overlay=TRUE)

#model for Nestedness
model4 <- glmmTMB(nestedness/100 ~ offset(log(species)) + type + season +
(1|farm), data=avocado_data, family=list(family="beta", link="logit"))
summary(model4)
#diagnostic plots
simulationOutput <- simulateResiduals(fittedModel = model4, n = 1000)
plotSimulatedResiduals(simulationOutput = simulationOutput)
visreg(model4, pch=16, cex=2, rug=FALSE, ylab="Nestedness",
line.par=list(col="darkgreen"), points.par=list(col="red", cex=1.5),
overlay=TRUE) #does not work with glmmTMB :-(
plot(allEffects(model4)) #doesn't work either . Any alternatives?

###############################


*Dr. Mariano Devoto*

Profesor Adjunto - Cátedra de Botánica General, Facultad de Agronomía de la
UBA
Investigador Adjunto del CONICET

Av. San Martín 4453 - C1417DSE - C. A. de Buenos Aires - Argentina
+5411 4524-8069
*https://www.researchgate.net/profile/Mariano_Devoto
<https://www.researchgate.net/profile/Mariano_Devoto>*

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list