2024-10-30

Introduction

In this presentation, I will explore interval estimation on data about rainfall and weather in Australia. To do this, I will be:

  • Estimating confidence intervals for mean rainfall in different months of the year.
  • Constructing prediction intervals to forecast future potential rainfall values.
  • Finding average min and max means in the 5 biggest Australian cities to explore potential future interval estimations.

Introducing the Equations

The formulas used for confidence and prediction intervals include: \[ \text{Confidence Interval (CI)} = \bar{x} \pm z \frac{\sigma}{\sqrt{n}} \] \[ \text{Prediction Interval (PI)} = \bar{x} \pm z \cdot s \sqrt{1 + \frac{1}{n}} \] Where:

  • \(\bar{x}\) is the sample mean and \(n\) is the sample size,
  • \(z\) and \(t\) are critical values for the chosen confidence level,
  • and \(\sigma\) is the population standard deviation (or \(s\) for sample standard deviation)

Code for Calculating Confidence Intervals of Rainfall by Month

rainfall_stats <- weather %>%
  group_by(Month) %>%
  summarise(
    mean_rainfall = mean(Rainfall, na.rm = TRUE),
    sd_rainfall = sd(Rainfall, na.rm = TRUE),
    n = n()
  )
alpha <- 0.05
z_critical <- qnorm(1 - alpha / 2)
rainfall_stats <- rainfall_stats %>%
  mutate(
    margin = z_critical * (sd_rainfall / sqrt(n)),
    lower_bound = mean_rainfall - margin,
    upper_bound = mean_rainfall + margin,
  )

Plotting the Confidence Intervals

Analysis

  • The previous plot shows that January, February, March and June are the months with the most rainfall in Australia.
  • The Confidence Intervals usually get wider the more rainfall there is, as expected.
  • The data shows that at 95% confidence, the actual mean is very close to the expected mean (within ~0.25mm at most).

Predictions for future monthly rainfall

As stated previously, we will be using the Prediction Interval equation to predict future monthly values for rainfall. \[ \text{Prediction Interval (PI)} = \bar{x} \pm z \cdot s \sqrt{1 + \frac{1}{n}} \] For example, if I use January where the average is 2.74, 1.96 z-score, 11.09 as the standard deviation, and n is 13236, the calculation becomes: \[ \text{Prediction Interval (PI)} = {2.74} \pm 1.96 \cdot 11.09 \sqrt{1 + \frac{1}{13236}} \] or \[ \text{Prediction Interval (PI)} = {2.74} \pm {21.74} \]

Important Note

  • Because rainfall cannot be less than 0, any value below 0 for rainfall estimation will automatically be increased to 0 to show more accurate real-world results.

Plotting Prediction Intervals

Analysis

  • This graph gives a lot of insight as to the variability of the data, and shows that 95% of expected data will fall between the ranges shown.
  • Months like January and February have much more variation and are more unpredictable than months like September and October.
  • One interesting difference between this graph and the previous one is that June is shown to have much less extreme values than January or March, despite the fact that its mean is about even to those two months. This could mean that June has more consistently high amounts of rainfall whereas January or March have more sporadic high values (more extremes).

Code for a 3D Plot Usable for Future Exploration

five_cities <- c("Sydney", "Melbourne", "Brisbane", "Perth", "Adelaide")
cities <- weather %>%
  filter(Location %in% five_cities)
intervals <- cities %>%
  group_by(Year, Location) %>%
  summarise(
    MeanMaxTemp = mean(MaxTemp, na.rm = TRUE),
    MeanMinTemp = mean(MinTemp, na.rm = TRUE),
    .groups = 'drop'
  )
plot_ly(data = intervals, x = ~MeanMaxTemp, y = ~MeanMinTemp, z = ~Year, 
        color = ~Location, colors = 'viridis', type = 'scatter3d', 
        mode = 'markers') %>%
  layout(title = '3D Scatter Plot of Average Min and Max Temperatures',
         scene = list(xaxis = list(title = 'Mean Max Temp (C)'),
                      yaxis = list(title = 'Mean Min Temp (C)'),
                      zaxis = list(title = 'Year')))

3D Plot of Average Min and Max Temperatures in 5 Australian Cities

Explanation for 3D Plot

While this 3D Plot does not directly use interval estimation, I believe it shows multiple directions that exploring interval estimation with this data could go, with the mean min and max temperatures for each city having interesting results that could lead to conversations about global warming.

In the future, I think it would be worthwhile to explore this data of temperature more to see if there are any significant trends among the temperature data and if anything interesting can be found with confidence or prediction interval exploration.

Thank you for viewing this presentation :)