Hydroids taxa~Depth+I(Depth^2)+ Class+Block+Depth:Block # Depth+ Depth^2+Class+Block+Depth:Block tryCatch(taxa33.glm <- glm(taxa~Depth+I(Depth^2)+ Class+Block+Depth:Block, family=binomial(link="logit"), data=taxa.df), warning = function(x) { output.df[33,"flag"] <<- 1 }, finally = taxa33.glm <- glm(taxa~Depth+I(Depth^2)+ Class+Block+Depth:Block, family=binomial(link="logit"), data=taxa.df) ) summary(taxa33.glm) MODEL SUMMARY: ============== Call: glm(formula = hydroid ~ Depth + I(Depth^2) + factor(Class) + factor(Block) + Depth:factor(Block), family = binomial(link="logit"), data = na.omit(d)) Deviance Residuals: Min 1Q Median 3Q Max -2.3139 -0.5898 -0.3904 -0.0679 3.0037 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -8.4997924 1.5209153 -5.589 2.29e-08 *** Depth 0.1327309 0.0282624 4.696 2.65e-06 *** I(Depth^2) -0.0005203 0.0001674 -3.108 0.00188 ** factor(Class)2 3.1719054 0.2897839 10.946 < 2e-16 *** factor(Class)3 3.8009031 0.5451951 6.972 3.13e-12 *** factor(Block)2 1.5962789 1.4989529 1.065 0.28691 factor(Block)3 5.7171958 1.4296933 3.999 6.36e-05 *** Depth:factor(Block)2 -0.0310252 0.0195242 -1.589 0.11205 Depth:factor(Block)3 -0.0515432 0.0197311 -2.612 0.00899 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 1016.09 on 922 degrees of freedom Residual deviance: 632.84 on 914 degrees of freedom AIC: 650.84 Number of Fisher Scoring iterations: 6 Analysis of Deviance Table Model: binomial, link: logit Response: hydroid Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev NULL 922 1016.09 Depth 1 57.68 921 958.41 I(Depth^2) 1 1.50 920 956.92 factor(Class) 2 223.61 918 733.31 factor(Block) 2 91.52 916 641.78 Depth:factor(Block) 2 8.95 914 632.84 resampled to 10 meters.Krigsman, 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.