Cup coral taxa~Depth+Class+Block+Class:I(Depth^2) # Depth + Class + Block +Class:I(Depth^2) tryCatch(taxa36.glm <- glm(taxa~Depth+Class+Block+Class:I(Depth^2), family=binomial(link="logit"), data=taxa.df), warning = function(x) { output.df[36,"flag"] <<- 1 }, finally = taxa36.glm <- glm(taxa~Depth+Class+Block+Class:I(Depth^2), family=binomial(link="logit"), data=taxa.df) ) summary(taxa36.glm) MODEL SUMMARY: ============== Call: glm(formula = cup_coral ~ Depth + factor(Class) + factor(Block) + factor(Class):I(Depth^2), family = binomial(link="logit"), data = na.omit(d)) Deviance Residuals: Min 1Q Median 3Q Max -2.36330 -0.52518 -0.19787 -0.05944 3.01412 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -5.9189217 1.0497440 -5.638 1.72e-08 *** Depth 0.0906923 0.0290678 3.120 0.00181 ** factor(Class)2 5.0554976 0.6663985 7.586 3.29e-14 *** factor(Class)3 6.7506467 0.9527576 7.085 1.39e-12 *** factor(Block)2 -0.8342323 0.2385245 -3.497 0.00047 *** factor(Block)3 -1.7776564 0.7832775 -2.270 0.02324 * factor(Class)1:I(Depth^2) -0.0003605 0.0002207 -1.633 0.10241 factor(Class)2:I(Depth^2) -0.0006365 0.0002346 -2.713 0.00666 ** factor(Class)3:I(Depth^2) -0.0008648 0.0003448 -2.508 0.01214 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 992.38 on 922 degrees of freedom Residual deviance: 543.69 on 914 degrees of freedom AIC: 561.69 Number of Fisher Scoring iterations: 7 Analysis of Deviance Table Model: binomial, link: logit Response: cup_coral Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev NULL 922 992.38 Depth 1 123.20 921 869.18 factor(Class) 2 290.73 919 578.45 factor(Block) 2 20.96 917 557.49 factor(Class):I(Depth^2) 3 13.80 914 543.69Krigsman, L.M., M.M. Yoklavich, E.J. Dick, and G.R. Cochrane (2012) Models and maps: predicting the distribution of corals and other benthic macro-invertebrates in shelf habitats. Ecosphere 3:1-16.