There are two major characteristics of earthquakes that make them different from each other: how far they are beneath Earth’s surface (the depth) and how much energy (magnitude) they generate. This project looks at the following research question: With respect to their depth, do earthquakes with greater depths have lower or higher magnitudes? The development of a stronger understanding of the correlation between the depth of an earthquake and the amount of energy it generates will allow for a more accurate way to evaluate the potential impact that different geological settings could have on future earthquakes, since deep earthquakes will behave differently than shallow earthquakes in relation to how the waves travel through the rock and what level ground shaking will occur at the surface.
The data used for this analysis was collected from the United States Geological Survey Earthquake Hazards Program by conducting various searches of the global seismic monitoring data for the occurrence of seismic events with sizes of 2.5 or larger (USGS Earthquake Hazards Program; https://earthquake.usgs.gov/earthquakes/search/). The geographical areas of these earthquake events span the globe, and records of these events over the past 30 days have been provided as a dataset. The variables used in this analysis are:
The approach taken to answer my research question was to load and clean the data set, selecting only the columns relevant to answering the question and deleting all rows with missing values for either ‘mag’ or ‘depth’. To explore these variables, I performed exploratory data analysis on both ‘mag’ and ‘depth’ using the summary and mean functions in R. In addition, to examine the relationship between them more closely, I created depth categories (shallow, intermediate, and deep) using the mutate and filter functions and calculated the average magnitude for each category. Finally, I plotted the data as a scatter plot of depth against magnitude and created a bar chart showing average magnitudes by depth category.
library(tidyverse)
# Load dataset
eq <- read_csv("2.5_month.csv")
# Select relevant columns and remove missing values
eq_clean <- eq %>%
select(time, place, mag, depth) %>%
filter(!is.na(mag), !is.na(depth))
# Preview the cleaned dataset
head(eq_clean)
## # A tibble: 6 × 4
## time place mag depth
## <dttm> <chr> <dbl> <dbl>
## 1 2026-04-06 14:50:21 21 km WNW of Mentone, Texas 2.5 4.82
## 2 2026-04-06 14:07:34 17 km W of Union City, Oklahoma 2.49 7.57
## 3 2026-04-06 13:20:20 12 km SW of Punta Cana, Dominican Republic 3.41 56.5
## 4 2026-04-06 13:14:51 116 km SE of Koshima, Japan 4.6 10
## 5 2026-04-06 13:09:29 South Sandwich Islands region 4.9 10
## 6 2026-04-06 12:54:18 84 km SE of Chignik, Alaska 2.5 4.4
# Summary statistics for magnitude and depth
summary(eq_clean$mag)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.450 2.900 3.830 3.768 4.500 7.500
summary(eq_clean$depth)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -3.40 10.00 20.97 57.76 54.33 698.13
# Mean magnitude and depth
mean(eq_clean$mag)
## [1] 3.767806
mean(eq_clean$depth)
## [1] 57.75795
# Categorize earthquakes by depth
eq_clean <- eq_clean %>%
mutate(depth_category = case_when(
depth < 70 ~ "Shallow (< 70 km)",
depth < 300 ~ "Intermediate (70-300 km)",
TRUE ~ "Deep (> 300 km)"
))
# Average magnitude per depth category
avg_mag <- eq_clean %>%
group_by(depth_category) %>%
summarise(avg_magnitude = mean(mag), count = n())
avg_mag
## # A tibble: 3 × 3
## depth_category avg_magnitude count
## <chr> <dbl> <int>
## 1 Deep (> 300 km) 4.43 82
## 2 Intermediate (70-300 km) 3.96 342
## 3 Shallow (< 70 km) 3.69 1631
# Scatter plot: depth vs magnitude
ggplot(eq_clean, aes(x = depth, y = mag)) +
geom_point(alpha = 0.4, color = "steelblue") +
geom_smooth(method = "lm", color = "red", se = TRUE) +
labs(
title = "Earthquake Depth vs. Magnitude (Global, Past 30 Days)",
x = "Depth (km)",
y = "Magnitude",
caption = "Source: USGS Earthquake Hazards Program"
) +
theme_minimal()
# Bar chart: average magnitude by depth category
ggplot(avg_mag, aes(x = depth_category, y = avg_magnitude, fill = depth_category)) +
geom_col(show.legend = FALSE) +
labs(
title = "Average Magnitude by Earthquake Depth Category",
x = "Depth Category",
y = "Average Magnitude",
caption = "Source: USGS Earthquake Hazards Program"
) +
theme_minimal()
The deep and shallow earthquake hold nearly similar levels of magnitude. The figures above illustrate the extent of the divergence in magnitudes at depth. There is no clear linear connection between depth and magnitude based on the scatter plot due to these factors contributing significantly to the variability between earthquakes. The relatively low level of variability across all depths demonstrates that all the tectonic settings, fault types and the velocity of plates contribute to how large an earthquake can be.
Consistent with what is known about seismic activity, deep earthquakes occur in subducting tectonic plates as they are denser and therefore hold more elastic energy than shallow earthquakes. These conclusions suggest that further investigation on the relationship between magnitude and depth, over a longer period of time or by integrating existing tectonic plate boundary will help identify if the depth/magnitude relationship varies based upon the tectonic boundary type. Further geographical analysis, beyond a global analysis, could provide details of varying seismic activities by region.
U.S. Geological Survey. (2026). USGS Earthquake Hazards Program: Earthquake Search. Retrieved April 6, 2026, from https://earthquake.usgs.gov/earthquakes/search/