Coral reef bleaching stress extent

The dataset

You will work with an annual measure of coral reef heat stress exposure called the 365-day Bleaching Stress Extent v3.1. The original metric and data come from NOAA’s Coral Reef Watch.

The original Coral Reef Watch product is calculated daily. For each date, it looks back over the preceding 365 days and identifies which reef-containing areas experienced Alert Level 1 or higher in the Coral Reef Watch bleaching heat stress alert system at least once during that period.

The tropical oceans are divided into 5 km pixels, and pixels containing coral reefs are identified. The Bleaching Stress Extent then reports the percentage of these reef-containing pixels that experienced bleaching-level heat stress during the preceding 365 days.

The product therefore measures the spatial extent of bleaching-level heat stress exposure. It does not measure:

  • the percentage of reefs experiencing heat stress on one particular day;
  • the average intensity of the heat stress;
  • the percentage of reefs that actually bleached; or
  • the amount of coral mortality.

The annual data

The original daily data have already been pre-processed for you. For each year, the supplied dataset contains the Bleaching Stress Extent value for 31 December.

Because each 31 December value represents the preceding 365 days, it provides an estimate of the percentage of reef-containing pixels exposed to bleaching-level heat stress during that calendar year.

For example, the value for 2020 represents the percentage of reef-containing pixels that experienced Alert Level 1 or higher at least once during approximately January–December 2020.

The values have also been converted from fractions to percentages, and the variables have been given clearer names.

The resulting file is in the data/ folder you downloaded with this R Markdown file and is called:

5km-v3.1_stats-alert01_baa5-max-365d_yearly.csv

The dataset includes annual percentages for:

  • the tropical oceans globally;
  • the Pacific Ocean;
  • the Atlantic Ocean; and
  • the Indian Ocean.

For your core analysis, use the variable:

Global_Stress_Extent

This represents the percentage of reef-containing pixels across the global tropical oceans that experienced bleaching-level heat stress during that year.

If you have time, you may later repeat your analysis for one or more individual ocean basins.

Your modelling goal

Your overall goal is to investigate whether an ENSO index can help to describe annual variation in the extent of tropical coral reef bleaching-level heat stress.

For your ENSO predictor, we recommend using RONI because it has already been averaged across three-month periods.

There is no single short global coral reef stress season that obviously determines which RONI period should be used. The Global response combines reefs from different tropical ocean basins, and the annual response accumulates exposure throughout the year.

You will therefore compare a small number of RONI periods representing ENSO conditions at different stages of the stress year:

  • NDJ entering the stress year;
  • FMA early in the stress year;
  • MJJ around the middle of the stress year; and
  • ASO late in the stress year.

These models should primarily be interpreted as descriptive models of historical association. However, the timing of the selected RONI period still matters when considering whether the relationship could potentially provide useful information before the stress year is complete.

There is not necessarily one uniquely correct model. Your goal is to make a reasonable modelling choice and support it using the data, the model results and your understanding of the timing represented by the predictor and response variables.

Analysis workbook

This R Markdown file records your analysis: data preparation, modelling choices, code, plots and model results.

You will submit a separate Case Study Interpretation that uses evidence from this analysis to explain what the model implies about the natural system and to evaluate its limitations, testability and usefulness.

You should briefly explain important modelling decisions in this workbook, but you do not need to write the full scientific interpretation here. As you work, briefly record the reasoning behind important modelling decisions as notes in this workbook. These notes can be short (usually one or two sentences) and can be provided as comments alongside the code or as separate text outside of the code blocks.

Core expectations

Your analysis should include the following:

  1. Read, inspect and understand the annual stress dataset.

    Read the annual data from the CSV file and inspect its variables and values.

    Make sure you can explain what one observation of Global_Stress_Extent represents. Remember that it is a percentage measuring the spatial extent of bleaching-level heat stress exposure, not the percentage of reefs that actually bleached.

  2. Explore the annual global stress data.

    Plot Global_Stress_Extent as a function of year.

    Describe the main patterns you observe, including:

    • years with particularly high or low stress extent;
    • changes in the size or frequency of the peaks; and
    • any possible long-term trend.
  3. Decide whether detrending is appropriate.

    Based on your plot, decide whether there appears to be an underlying trend that should be removed before examining the relationship with ENSO. If so, select a suitable polynomial to represent the trend, and calculate and plot the resulting annual anomalies. Your decision should be based on the data, and you should explain your reasoning.

  4. Read and inspect the RONI dataset.

    The RONI data are the same as those that we used in previous weeks. They are available in the data/ folder:

    NOAA_RONI_1950-2025.csv

    Remember that each RONI column represents a different three-month averaging period.

  5. Align the four candidate RONI periods.

    Compare the following candidate predictors:

    • NDJ entering the stress year;
    • FMA early in the stress year;
    • MJJ around the middle of the stress year; and
    • ASO late in the stress year.

    Determine the years for which both the annual stress data and RONI data are available. Be particularly careful with NDJ. In the RONI dataset, NDJ is labelled using the year in which November and December occur. This means:

    • NDJ 2024 represents November 2024, December 2024 and January 2025;
    • it should therefore be paired with the annual stress response for 2025.

    In contrast, FMA, MJJ and ASO occur entirely within the stress year. For example, FMA 2025, MJJ 2025 and ASO 2025 should all be paired with the annual stress response for 2025.

    Check your combined data carefully to make sure the years have been aligned correctly.

  6. Construct and compare the candidate models.

    For each candidate RONI period:

    • make a scatterplot of the annual stress response (stress values or anomalies) as a function of RONI;
    • fit a linear model;
    • calculate the predicted annual stress values or anomalies;
    • compare the observed and predicted stress values or anomalies;
    • examine the model residuals; and
    • calculate the R² value.

    Make sure that you use the same response variable—either raw stress extent or detrended stress anomalies—in all four candidate models.

  7. Select a preferred model.

    Decide which RONI period produces your preferred model. Base your decision on both:

    • the model results, including the plots, residuals and R² values; and
    • whether the timing and direction of the relationship are physically interpretable.

    Do not select a model only because it has the largest R². If several periods produce similar model fits, say so and explain why you selected one of them.

  8. Document your preferred model.

    Clearly identify your preferred model and include:

    • the predictor and response variables used;
    • the modelling choices you made (and why), including the RONI period and your detrending decisions;
    • an appropriate scatterplot of the predictor and response;
    • a comparison of the observed and predicted response values or anomalies;
    • residual information;
    • the model’s R² value; and
    • a brief statement identifying the direction of the fitted relationship.

    Make sure your code, plots and outputs are clearly labelled so that you can refer to them in your separate Case Study Interpretation.

Remember: There is not necessarily one uniquely correct model. A well-justified model based on a useful and physically sensible time period is more important than simply finding the RONI period with the highest R².

Optional extensions if time permits

Once you have completed the core analysis, you could extend it by doing one or more of the following:

  • examine how sensitive your conclusion is to moving the selected RONI period one month earlier or later;
  • test how sensitive your conclusion is to your choices about detrending the heat stress data;
  • repeat the analysis using the Pacific, Atlantic or Indian Ocean stress extent;
  • use RNino3.4 instead of RONI and choose an appropriate monthly value or averaging period.

Your response

You’ll need to use multiple R cells to work through this - we’ve started you off with a few, but you can add more using the “Insert” menu in RStudio and choosing “Executable Cell” then “R”.

Make sure to include your notes documenting your important modelling decisions and your preferred model, either as comments within the R cells or as text before, after, or between the code cells.

StressData <- read.csv("data/5km-v3.1_stats-alert01_baa5-max-365d_yearly.csv")
RONI_Data <- read.csv("data/NOAA_RONI_1950-2025.csv")

head(StressData)
##   Year       Date Global_Stress_Extent Pacific_Stress_Extent
## 1 1986 1986-12-31                3.480                 3.820
## 2 1987 1987-12-31                8.420                10.649
## 3 1988 1988-12-31                4.414                 2.752
## 4 1989 1989-12-31                1.348                 0.987
## 5 1990 1990-12-31                1.544                 0.811
## 6 1991 1991-12-31                1.377                 0.995
##   Atlantic_Stress_Extent Indian_Stress_Extent
## 1                  0.000                4.400
## 2                  0.464                6.202
## 3                  1.510               10.976
## 4                  0.000                3.171
## 5                  1.256                3.885
## 6                  0.030                3.263
tail(StressData)
##    Year       Date Global_Stress_Extent Pacific_Stress_Extent
## 35 2020 2020-12-31               37.555                36.083
## 36 2021 2021-12-31               23.521                22.355
## 37 2022 2022-12-31               28.358                31.507
## 38 2023 2023-12-31               34.289                23.387
## 39 2024 2024-12-31               74.664                69.503
## 40 2025 2025-12-31               42.235                35.252
##    Atlantic_Stress_Extent Indian_Stress_Extent
## 35                 47.032               36.679
## 36                 28.084               24.458
## 37                 32.885               16.472
## 38                 95.917               32.536
## 39                 93.465               79.593
## 40                 93.435               34.604
head(RONI_Data)
##   Year  DJF  JFM  FMA  MAM  AMJ  MJJ  JJA  JAS  ASO  SON  OND  NDJ
## 1 1950 -1.5 -1.3 -1.1 -1.1 -1.0 -0.7 -0.4 -0.2 -0.2 -0.3 -0.4 -0.6
## 2 1951 -0.5 -0.2  0.3  0.6  0.6  0.7  0.7  0.8  0.9  1.0  0.9  0.8
## 3 1952  0.6  0.4  0.4  0.4  0.3  0.1  0.0  0.0  0.1  0.0  0.0  0.2
## 4 1953  0.5  0.8  0.8  0.8  0.8  0.8  0.7  0.7  0.7  0.8  0.8  0.9
## 5 1954  1.0  0.7  0.1 -0.2 -0.3 -0.3 -0.5 -0.7 -0.8 -0.7 -0.6 -0.4
## 6 1955 -0.4 -0.3 -0.3 -0.4 -0.4 -0.4 -0.4 -0.6 -1.0 -1.4 -1.6 -1.3
tail(RONI_Data)
##    Year  DJF  JFM  FMA  MAM  AMJ  MJJ  JJA  JAS  ASO  SON  OND  NDJ
## 71 2020  0.1  0.1  0.0 -0.3 -0.6 -0.8 -0.8 -0.9 -1.2 -1.5 -1.5 -1.4
## 72 2021 -1.2 -1.0 -1.0 -0.8 -0.6 -0.5 -0.6 -0.7 -0.9 -1.1 -1.2 -1.2
## 73 2022 -1.2 -1.2 -1.3 -1.3 -1.2 -1.0 -0.9 -1.0 -1.1 -1.1 -1.0 -1.0
## 74 2023 -0.8 -0.6 -0.4 -0.2  0.1  0.4  0.6  0.9  1.1  1.4  1.5  1.5
## 75 2024  1.2  0.9  0.5  0.1 -0.3 -0.5 -0.5 -0.6 -0.8 -0.8 -0.9 -1.1
## 76 2025 -1.1 -0.9 -0.7 -0.5 -0.5 -0.4 -0.5 -0.6 -0.8 -0.9 -0.9 -1.0
# Print the exact start and end years of StressData
print(StressData$Year)
##  [1] 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
## [16] 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015
## [31] 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025
# Plot raw Global_Stress_Extent over time
plot(
  x = StressData$Year,
  y = StressData$Global_Stress_Extent,
  type = "l",
  lwd = 2,
  xlab = "Year",
  ylab = "Global Stress Extent (%)",
  main = "Annual Global Coral Reef Heat Stress Extent"
)

# Fit a degree 2 polynomial to capture the long-term warming trend
detrend.model <- lm(
  Global_Stress_Extent ~ poly(Year, degree = 2),
  data = StressData
)
trend.predicted <- predict(detrend.model)

# Overlay the red trend line on the plot
lines(
  x = StressData$Year,
  y = trend.predicted,
  type = "l",
  col = "red",
  lwd = 2
)

# Calculate detrended anomalies and plot them
StressData$anomaly <- residuals(detrend.model)

plot(
  x = StressData$Year,
  y = StressData$anomaly,
  type = "l",
  lwd = 2,
  xlab = "Year",
  ylab = "Detrended Stress Extent Anomaly (%)",
  main = "Detrended Annual Global Stress Extent Anomalies"
)
abline(h = 0, lty = 2, col = "gray")

# Define overlapping years: 1986 to 2025 (40 years)
stress_years <- 1986:2025
ndj_years <- 1985:2024 # Shifted back 1 year so NDJ 1985 pairs with Stress 1986, up to NDJ 2024 -> Stress 2025

# Identify matching rows using %in%
stress_rows <- StressData$Year %in% stress_years
same_year_roni_rows <- RONI_Data$Year %in% stress_years
ndj_roni_rows <- RONI_Data$Year %in% ndj_years

# Extract aligned columns
stress_year <- StressData$Year[stress_rows]
stress_anomaly <- StressData$anomaly[stress_rows]

ndj_year_check <- RONI_Data$Year[ndj_roni_rows]
roni_year_check <- RONI_Data$Year[same_year_roni_rows]

NDJ <- RONI_Data$NDJ[ndj_roni_rows]
FMA <- RONI_Data$FMA[same_year_roni_rows]
MJJ <- RONI_Data$MJJ[same_year_roni_rows]
ASO <- RONI_Data$ASO[same_year_roni_rows]

# Combine into one aligned dataframe
Combined_data <- data.frame(
  stress_year,
  ndj_year_check,
  roni_year_check,
  stress_anomaly,
  NDJ,
  FMA,
  MJJ,
  ASO
)

# Verify alignment (ndj_year_check should always be 1 year before stress_year)
head(Combined_data)
##   stress_year ndj_year_check roni_year_check stress_anomaly  NDJ  FMA  MJJ  ASO
## 1        1986           1985            1986     -2.7346134 -0.2 -0.2 -0.1  0.9
## 2        1987           1986            1987      3.0133031  1.5  1.3  1.1  1.5
## 3        1988           1987            1988     -0.2807304  0.9 -0.2 -1.7 -1.4
## 4        1989           1988            1989     -2.7307140 -1.9 -1.1 -0.4 -0.2
## 5        1990           1989            1990     -2.0146476  0.0  0.3  0.2  0.4
## 6        1991           1990            1991     -1.7575312  0.5  0.4  0.7  0.9
tail(Combined_data)
##    stress_year ndj_year_check roni_year_check stress_anomaly  NDJ  FMA  MJJ
## 35        2020           2019            2020       4.981579  0.2  0.0 -0.8
## 36        2021           2020            2021     -11.506806 -1.4 -1.0 -0.5
## 37        2022           2021            2022      -9.220141 -1.2 -1.3 -1.0
## 38        2023           2022            2023      -5.935426 -1.0 -0.4  0.4
## 39        2024           2023            2024      31.697340  1.5  0.5 -0.5
## 40        2025           2024            2025      -3.569845 -1.1 -0.7 -0.4
##     ASO
## 35 -1.2
## 36 -0.9
## 37 -1.1
## 38  1.1
## 39 -0.8
## 40 -0.8
# Fit all four candidate linear models
model.NDJ <- lm(stress_anomaly ~ NDJ, data = Combined_data)
model.FMA <- lm(stress_anomaly ~ FMA, data = Combined_data)
model.MJJ <- lm(stress_anomaly ~ MJJ, data = Combined_data)
model.ASO <- lm(stress_anomaly ~ ASO, data = Combined_data)

# Print R-squared values for all four models to compare
summary(model.NDJ)$r.squared
## [1] 0.3901137
summary(model.FMA)$r.squared
## [1] 0.2680854
summary(model.MJJ)$r.squared
## [1] 0.02993275
summary(model.ASO)$r.squared
## [1] 0.08984415
# Full model summary (slope, intercept, R-squared) for preferred model (NDJ)
summary(model.NDJ)
## 
## Call:
## lm(formula = stress_anomaly ~ NDJ, data = Combined_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -12.6215  -4.7680  -0.9474   4.1522  23.9591 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.1887     1.2007   0.157    0.876    
## NDJ           5.0330     1.0209   4.930 1.65e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.59 on 38 degrees of freedom
## Multiple R-squared:  0.3901, Adjusted R-squared:  0.3741 
## F-statistic: 24.31 on 1 and 38 DF,  p-value: 1.651e-05
# Calculate predicted anomalies and residuals
pred.NDJ <- predict(model.NDJ)
res.NDJ <- residuals(model.NDJ)

# Plot 1: Scatterplot of Stress Anomaly vs NDJ RONI with regression line
plot(
  x = Combined_data$NDJ,
  y = Combined_data$stress_anomaly,
  type = "p",
  pch = 16,
  xlab = "NDJ RONI (Entering Stress Year)",
  ylab = "Detrended Stress Extent Anomaly (%)",
  main = "Preferred Model: Global Stress Anomaly vs. NDJ RONI"
)
abline(model.NDJ, col = "blue", lwd = 2)

# Plot 2: Observed vs Predicted time series comparison
plot(
  x = Combined_data$stress_year,
  y = Combined_data$stress_anomaly,
  type = "l",
  lwd = 2,
  xlab = "Stress Year",
  ylab = "Detrended Stress Extent Anomaly (%)",
  main = "Observed (Black) vs. Predicted (Red) Stress Anomalies"
)
lines(
  x = Combined_data$stress_year,
  y = pred.NDJ,
  type = "l",
  col = "red",
  lwd = 2
)

# Plot 3: Residuals vs NDJ RONI
plot(
  x = Combined_data$NDJ,
  y = res.NDJ,
  type = "p",
  pch = 16,
  xlab = "NDJ RONI (Entering Stress Year)",
  ylab = "Residuals (%)",
  main = "Preferred Model Residuals vs. NDJ RONI"
)
abline(h = 0, lty = 2, col = "gray")

### Modelling Decisions & Preferred Model Summary

  • Variable Definition: Global_Stress_Extent represents the percentage of global tropical reef-containing 5 km pixels exposed to Alert Level 1 or higher bleaching heat stress at least once during the 365 days ending 31 December.
  • Detrending Decision: The raw Global_Stress_Extent series shows a strong upward long-term trend and increasingly large peaks over 1986–2025 due to ongoing ocean warming. A degree-2 polynomial was fitted to remove this long-term trend so the linear model isolates year-to-year anomalies driven by ENSO variability.
  • Year Alignment: Because NDJ in the RONI dataset is labelled by the November/December year, NDJ for 1985–2024 was paired with Global_Stress_Extent anomalies for 1986–2025, while FMA, MJJ, and ASO were paired with the same calendar year (1986–2025).
  • Preferred Model Selection (NDJ): Comparing all four candidate models showed that NDJ entering the stress year produced the strongest fit (\(R^2 = 0.3901\)), followed by FMA (\(R^2 = 0.2681\)), ASO (\(R^2 = 0.0898\)), and MJJ (\(R^2 = 0.0299\)). Physically, ENSO events typically peak around NDJ and redistribute warm surface waters across tropical ocean basins throughout the following stress year, making NDJ both physically sensible and useful as an early indicator.
  • Direction & Residuals: The fitted linear relationship is positive (more positive NDJ RONI values correspond to higher global heat stress extent anomalies). The residuals centre around zero, though positive residual spikes occur during extreme El Niño bleaching years, indicating non-linear amplification during major events.

Prepare for your Case Study Interpretation

Once your analysis and documentation notes are complete, use your results to begin planning the separate Case Study Interpretation.

Discuss the following with your peers and the teaching staff or make brief planning notes for yourself. You do not need to write the answers in this R Markdown workbook. Use the separate Case Study Interpretation template on LearnJCU for your interpretation.

Remember that your model identifies an association between RONI and the response variable. It does not directly test the environmental, biological or human processes that might connect them, and it does not by itself demonstrate that ENSO caused the observed response.

Make sure you can explain:

  • the modelling question, the key variables and at least one assumption;
  • why you constructed the annual response and selected your RONI periods as you did;
  • why you did or did not detrend the response;
  • what specific plots and quantitative results you will use as evidence;
  • what the preferred model suggests about the natural system;
  • why the preferred model is scientifically defensible;
  • how the model could be tested using additional data or observations;
  • which processes, uncertainties or limitations affect confidence;
  • what the model can and cannot support; and
  • the model’s intended purpose and whether it is useful for that purpose.