# Analysis of F1 oviposition rate # Knegt etal # Title: Detection of genetic incompatibilities in non-model systems using simple # genetic markers: hybrid breakdown in the haplodiploid spider mite # Tetranychus evansi Knegt_etal_F1_oviposition <- read.csv("X:/YourDirectory/.../Knegt_etal_F1_oviposition.csv") Mites <- Knegt_etal_F1_oviposition rm (Knegt_etal_F1_oviposition) # GENERAL INFORMATION # F1.eggs.day is an average number of eggs laid per F1 female per day # So I expect a Gaussian distribution # The numbers of eggs laid might depend on experiment # The explanatory variables I have are mother and fertilized # UPKEEP # Get rid NAs Mites2 <- subset(Mites, F1.eggs.day > -1) # DATA EXPLORATION # Outliers boxplot(Mites2$F1.eggs.day) # Looks ok # Ouliers, variation and median for cross boxplot(F1.eggs.day ~ mother, data = Mites2) # Slight differences # Ouliers, variation and median for exp boxplot(F1.eggs.day ~ exp, data = Mites2) # Mites from first seem to have laid more eggs # Ouliers, variation and median for fertilized boxplot(F1.eggs.day ~ fertilized, data = Mites2) # Not much going on # Zeroes table(Mites2$F1.eggs.day) # or (nrow(subset(Mites2, F1.eggs.day == 0, select = F1.eggs.day))/length(Mites2$F1.eggs.day))*100 #percentage zeroes # No zero inflation # Normality hist(Mites2$F1.eggs.day, breaks = 8) # Hmm, not normal, perhaps transformation needed? # Interaction between mother and fertilized? interaction.plot(Mites2$mother, Mites2$fertilized, Mites2$F1.eggs.day) # Doesn't look like it # MODEL SELECTION M1 <- lm(F1.eggs.day ~ mother * fertilized + exp, data = Mites2) # I want to test whether: # - the interaction between mother and fertilized is significant # - the factor fertilized is significant at all # - the factor mother is significant at all drop1(M1, test = "F") # Interaction is not significant M2 <- lm(F1.eggs.day ~ mother + fertilized + exp, data = Mites2) drop1(M2, test = "F") # Mother not significant M3 <- lm(F1.eggs.day ~ fertilized + exp, data = Mites2) drop1(M3, test = "F") # fertilized and exp are both significant # MODEL VALIDATION # Residual patterns, heterogeneity or negative fitted values? plot(y = M3$resid, x = M1$fitted, xlab = "Fitted values", ylab = "Residuals") abline(h = 0) # Looks ok, some heterogeneity? # Variance ratio larger than 4? E3 <- resid(M3) tapply(E3, FUN = var, INDEX = Mites2$mother) tapply(E3, FUN = var, INDEX = Mites2$fertilized) tapply(E3, FUN = var, INDEX = Mites2$exp) # No # Independent from mother? boxplot(E3 ~ mother, data = Mites2) abline(0,0) # Yes # Independent from fertilized? boxplot(E3 ~ fertilized, data = Mites2) abline(0,0) # Yes # Independent from exp? boxplot(E3 ~ exp, data = Mites2) abline(0,0) # Yes # Residuals normally distributed? hist(E3, breaks = 10) # Yes! Apparently the model accounted for the non-normality. # Influential observations? plot(M3, which=4) # No summary(M3) # CONCLUSION # Number of eggs laid per F1 female per day depends on whether they are fertilized # exp was significant, but it is only included as a covariate, to account for # differences between the experiments # mother (the cross treatment) was not significant: F(3,294) = 0.17, p = 0.915 # fertilized was significant: F(1,297) = 22.10, p < 0.001 # exp was significant: F(1,297) = 52.99, p < 0.001 # In a Likelihood ratio test comparing models with and without the factor # Using a general linear model # END