coral_bleach.txt Coral Bleaching, temperature stress http://coralreefwatch.noaa.gov/satellite/education/tutorial/crw22_bleachingthreshold.php Cheryl A. Logan, John P Dunne, C. Mark Eakin, Simon D. Donner A framework for comparing coral bleaching thresholds Proceedings of the 12th International Coral Reef Symposium, Cairns, Australia, 9-13 July 2012 10A Modelling reef futures http://www.icrs2012.com/proceedings/manuscripts/ICRS2012_10A_3.pdf Fitt WK, et al. 2001. Coral Reefs 20:51-65 Coral bleaching: interpretation of thermal tolerance limits and thermal thresholds in tropicla corals. http://link.springer.com/article/10.1007/s003380100146#page-2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fit logistic regression model for coral bleaching as function of temperature. Simplified version (many stressors contribute to bleaching risk). > # Coral bleaching, w/ temp threshold = 30.5C > t.cool <- runif(100, 25, 30.7) # generate temps with no bleaching > t.bleach <- runif(20, 30.5, 33) # generate temps with bleaching > t.all <- c(t.cool, t.bleach) # combine temps as 1 explanatory variable > status.coral <- c(rep(1, 100), rep(0, 20)) # generate binary response var # 1 = not bleached, 0 = bleached > plot(t.all, status.coral, xlab="Water temperature (C)", ylab="Coral status") > mod.coral <- glm(status.coral ~ t.all, family=binomial) > summary(mod.coral) Call: glm(formula = status.coral ~ t.all, family = binomial) Deviance Residuals: Min 1Q Median 3Q Max -1.656 0.000 0.000 0.000 1.508 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 477.600 268.750 1.777 0.0755 . t.all -15.586 8.771 -1.777 0.0756 . --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 108.1347 on 119 degrees of freedom Residual deviance: 7.5044 on 118 degrees of freedom AIC: 11.504 Number of Fisher Scoring iterations: 12 > mod.coral$coefficients[1] (Intercept) 477.5996 > mod.coral$coefficients[2] t.all -15.58606 > # Plot model as solid line > t.seq <- seq(from=25, to=33, length=200) > pred.coral <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*t.seq) / + (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*t.seq)) > lines(t.seq, pred.coral) > # Calculate log-likelihood R^2: > logR2 <- 1 - 7.504 / 108.1 > logR2 [1] 0.9305828 > # Predict probability(bleaching) at temp =30.56C > p.306 <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*30.6) / + (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*30.6)) > p.306 > # Predict probability(bleaching) at temp =29.0C > p.29 <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*29) / + (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*29)) > p.29 (Intercept) 1 > # Predict probability(bleaching) at temp =31.0C > p.31 <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*31) / + (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*31)) > p.31 (Intercept) 0.003802225 # ******************************************************************** # Coral bleaching, w/ temp threshold = 30.5C t.cool <- runif(100, 25, 30.7) # generate temps with no bleaching t.bleach <- runif(20, 30.5, 33) # generate temps with bleaching t.all <- c(t.cool, t.bleach) # combine temps as 1 explanatory variable status.coral <- c(rep(1, 100), rep(0, 20)) # generate binary response var # 1 = not bleached, 0 = bleached plot(t.all, status.coral, xlab="Water temperature (C)", ylab="Coral status") mod.coral <- glm(status.coral ~ t.all, family=binomial) summary(mod.coral) # AIC value not relevant if only one model mod.coral$coefficients[1] mod.coral$coefficients[2] # Plot model as solid line t.seq <- seq(from=25, to=33, length=200) pred.coral <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*t.seq) / (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*t.seq)) lines(t.seq, pred.coral) # Calculate log-likelihood R^2: logR2 <- 1 - 7.504 / 108.1 logR2 # Predict probability(bleaching) at temp =30.6C p.306 <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*30.6) / (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*30.6)) p.306 # Predict probability(bleaching) at temp =29.0C p.29 <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*29) / (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*29)) p.29 # Predict probability(bleaching) at temp =31.0C p.31 <- exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*31) / (1 + exp(mod.coral$coefficients[1] + mod.coral$coefficients[2]*31)) p.31