The dataset has 22252 obs. with 36 vars. Each observation represents a water sample. The most relevant vars are latitude/longitude, ocean, microplastics_measurement, unit (of concentration), concentration_class, doi, and sample_date. The dataset was compiled by the NOAA (National Oceanic and Atmospheric Administration): both an interactive map and the raw dataset are available at https://www.ncei.noaa.gov/products/microplastics.
Cleaning procedure: because it is sourced from a U.S. agency, the data is relatively clean already. However, I still standardized var names, renamed those with spaces/parenthesis, and filtered out NA values.
# load libraries
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.5.3
## Warning: package 'ggplot2' was built under R version 4.5.2
## Warning: package 'readr' was built under R version 4.5.3
## Warning: package 'dplyr' was built under R version 4.5.3
## Warning: package 'forcats' was built under R version 4.5.3
## Warning: package 'lubridate' was built under R version 4.5.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.1 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.5.1
## ✔ ggplot2 4.0.1 ✔ tibble 3.3.0
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# load dataset
setwd("C:/Users/chesl/Desktop/DATA101/datasets")
df <- read_csv("marine_microplastic_concentrations.csv")
## Rows: 22530 Columns: 36
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (20): Ocean, Region, Subregion, Country, State, Beach Location, Marine S...
## dbl (16): OBJECTID, Latitude (degree), Longitude (degree), Ocean Bottom Dept...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
dim(df)
## [1] 22530 36
# dataset dimensions: 22530*36
names(df) <- tolower(names(df))
names(df) <- gsub(" ", "_", names(df))
df2 <- df |>
rename(latitude = `latitude_(degree)`) |>
rename(longitude = `longitude_(degree)`) |>
rename(depth = `water_sample_depth_(m)`) |>
filter(!is.na(ocean) & !is.na(latitude) & !is.na(longitude)) |>
filter(!is.na(microplastics_measurement) & !is.na(concentration_class))
# clean dataset dim: 16706*36
plot1 <- df2 |>
ggplot(aes(x = longitude, y = latitude, color = concentration_class)) +
geom_point(alpha = 0.5)
plot1
This simple visualization plots every sample by longitude/latitude onto a grip, forming a rudimentary map of the world. As many samples were taken in coastal waters, there is an outline of the continents/island chains present: the majority of these samples were taken within the Atlantic and Pacific Oceans. Noticeably, there seems to be a patch of high microplastic concentration in the Pacific Ocean, off the coast of California. South, however, is a space of very low concentration.
# best model
fit2 <- lm(microplastics_measurement ~ marine_setting + sampling_method, data = df2)
summary(fit2)
##
## Call:
## lm(formula = microplastics_measurement ~ marine_setting + sampling_method,
## data = df2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -48760 0 0 0 751160
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 49757 8765 5.677 1.40e-08
## marine_settingOcean sediment -47650 1311 -36.351 < 2e-16
## marine_settingOcean water -47667 8706 -5.475 4.43e-08
## sampling_methodAVANI net -2090 1639 -1.275 0.202258
## sampling_methodbox corer -2102 9142 -0.230 0.818193
## sampling_methodCTD rosette sampler -2043 1508 -1.355 0.175431
## sampling_methodDay grab -2076 8865 -0.234 0.814818
## sampling_methodEkman dredge -1992 8742 -0.228 0.819749
## sampling_methodEkman grab -1980 9002 -0.220 0.825903
## sampling_methodglass jar -2090 7765 -0.269 0.787828
## sampling_methodGrab sample -2090 1040 -2.009 0.044565
## sampling_methodHand picking -49756 8951 -5.559 2.76e-08
## sampling_methodIntake seawater pump -2076 1117 -1.858 0.063179
## sampling_methodKubiena box -2099 9142 -0.230 0.818435
## sampling_methodmanta net -2089 2127 -0.982 0.326164
## sampling_methodManta net -2088 1030 -2.027 0.042676
## sampling_methodMegacorer -2054 8704 -0.236 0.813471
## sampling_methodMetal scoop -40016 8803 -4.546 5.51e-06
## sampling_methodMetal spoon -917 8708 -0.105 0.916134
## sampling_methodNeuston net -2090 1022 -2.044 0.040970
## sampling_methodNiskin bottle -2090 1331 -1.570 0.116355
## sampling_methodPetite Ponar benthic grab -1889 8761 -0.216 0.829271
## sampling_methodplankton net -2090 1361 -1.536 0.124613
## sampling_methodPlankton net -2087 1264 -1.651 0.098770
## sampling_methodPVC cylinder -47955 8774 -5.465 4.68e-08
## sampling_methodRemotely operated vehicle -2098 8752 -0.240 0.810587
## sampling_methodSediment grab sampler -2000 8797 -0.227 0.820164
## sampling_methodShipek grab sampler -1828 9038 -0.202 0.839708
## sampling_methodshovel -2027 8714 -0.233 0.816032
## sampling_methodstainless-steel sampler 1432 1902 0.753 0.451456
## sampling_methodstainless-steel spatula -5405 8899 -0.607 0.543658
## sampling_methodstainless steel bucket -1980 2535 -0.781 0.434752
## sampling_methodStainless steel bucket -1092 1378 -0.792 0.428107
## sampling_methodStainless steel spoon -24224 8832 -2.743 0.006102
## sampling_methodSurface water intake 13738 3590 3.826 0.000131
## sampling_methodTrowel -48083 8821 -5.451 5.08e-08
## sampling_methodVan Dorn sampler -1164 1169 -0.995 0.319673
## sampling_methodVan Veen grab -1738 8728 -0.199 0.842219
##
## (Intercept) ***
## marine_settingOcean sediment ***
## marine_settingOcean water ***
## sampling_methodAVANI net
## sampling_methodbox corer
## sampling_methodCTD rosette sampler
## sampling_methodDay grab
## sampling_methodEkman dredge
## sampling_methodEkman grab
## sampling_methodglass jar
## sampling_methodGrab sample *
## sampling_methodHand picking ***
## sampling_methodIntake seawater pump .
## sampling_methodKubiena box
## sampling_methodmanta net
## sampling_methodManta net *
## sampling_methodMegacorer
## sampling_methodMetal scoop ***
## sampling_methodMetal spoon
## sampling_methodNeuston net *
## sampling_methodNiskin bottle
## sampling_methodPetite Ponar benthic grab
## sampling_methodplankton net
## sampling_methodPlankton net .
## sampling_methodPVC cylinder ***
## sampling_methodRemotely operated vehicle
## sampling_methodSediment grab sampler
## sampling_methodShipek grab sampler
## sampling_methodshovel
## sampling_methodstainless-steel sampler
## sampling_methodstainless-steel spatula
## sampling_methodstainless steel bucket
## sampling_methodStainless steel bucket
## sampling_methodStainless steel spoon **
## sampling_methodSurface water intake ***
## sampling_methodTrowel ***
## sampling_methodVan Dorn sampler
## sampling_methodVan Veen grab
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7698 on 16668 degrees of freedom
## Multiple R-squared: 0.1896, Adjusted R-squared: 0.1878
## F-statistic: 105.4 on 37 and 16668 DF, p-value: < 2.2e-16
# predictor(s): marine setting, sampling method
# response: measurement of microplastics
# adjusted R-squared value: 0.1878, p-value: <2.2e-16.
plot(fit2, which = 1) # residuals-fitted plot
# Residuals-fitted plot is extremely segregated into groups. Homoscedasticity is violated.
plot(fit2, which = 2) # Q-Q plot
## Warning: not plotting observations with leverage one:
## 16455
# Q-Q values drift from the horizontal line, especially several outliers. Normality is violated.
sqrt(mean(residuals(fit2)^2))
## [1] 7688.991
# rmse: 7688.991, very high.
predict(fit2, data.frame(marine_setting = "Ocean water", sampling_method = "Neuston net"))
## 1
## 0.1180493
# predicted value: 0.118
Unfortunately, as both homoscedasticity and normality is violated, the R-squared and p-value cannot be trusted to be accurate.
# filter to make boxplot medians visible
df3 <- df2 |>
filter(microplastics_measurement < 0.25)
plot2 <- df3 |>
ggplot(aes(x = ocean, y = microplastics_measurement)) +
geom_boxplot()
plot2
# plot suggests that the Indian Ocean has the highest average concentration of microplastics, but that the Pacific and Atlantic Oceans have many more outliers.
plot3 <- df3 |>
ggplot(aes(x = longitude, y = microplastics_measurement)) +
geom_point() +
geom_smooth(method = "loess")
plot3
## `geom_smooth()` using formula = 'y ~ x'
# reinforces the above suggestion. despite the thousands of high values, the regression curve raises at the longitude of the Indian Ocean.
df4 <- df3 |>
group_by(ocean) |>
summarize(n = n(), mean = mean(microplastics_measurement))
# the Atlantic Ocean has 8287 samples, Pacific Ocean has 3785, and the Indian Ocean has 364. This disparity in sample sizes is concerning, as the mean microplastic concentrations of the Indian, Arctic, and Southern Oceans are not nearly as accurate as those for the two oceans which have had thousands of samples.
fit3 <- aov(microplastics_measurement ~ ocean, data = df2)
summary(fit3)
## Df Sum Sq Mean Sq F value Pr(>F)
## ocean 4 2.591e+09 647707796 8.895 3.59e-07 ***
## Residuals 16701 1.216e+12 72815791
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# predictor value: ocean
# response: measurement of microplastics
# p-value: 3.59e-07
sqrt(mean(residuals(fit3)^2))
## [1] 8531.94
# rmse: 8531.94, even higher than the previous model.
predict(fit3, data.frame(ocean = "Atlantic Ocean"))
## 1
## 185.4612
# predicted value: 185.461
TukeyHSD(fit3)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = microplastics_measurement ~ ocean, data = df2)
##
## $ocean
## diff lwr upr p adj
## Atlantic Ocean-Arctic Ocean 177.913284 -1164.1690 1519.9955 0.9963525
## Indian Ocean-Arctic Ocean 162.253061 -1436.0495 1760.5556 0.9987138
## Pacific Ocean-Arctic Ocean 1008.671809 -350.3761 2367.7197 0.2540532
## Southern Ocean-Arctic Ocean -7.497091 -4678.6164 4663.6222 1.0000000
## Indian Ocean-Atlantic Ocean -15.660223 -942.7413 911.4209 0.9999990
## Pacific Ocean-Atlantic Ocean 830.758525 440.9900 1220.5270 0.0000001
## Southern Ocean-Atlantic Ocean -185.410375 -4671.4179 4300.5972 0.9999636
## Pacific Ocean-Indian Ocean 846.418748 -105.0569 1797.8944 0.1082024
## Southern Ocean-Indian Ocean -169.750152 -4738.9569 4399.4566 0.9999762
## Southern Ocean-Pacific Ocean -1016.168900 -5507.2813 3474.9435 0.9723973
# significant difference found between Pacific and Atlantic Ocean, with less significant evidence for a difference between Pacific and Arctic/Indian Oceans. This is likely because the Pacific and Atlantic Oceans had the most samples taken, and thus have a more accurate comparison.
The dataset, while large, is incomplete. The Pacific and Atlantic Oceans are disproportionately represented, and thus can only be reliably compared with each other. To improve, this dataset needs to be updated with more samples from the Indian, and especially Arctic and Southern Oceans. As current data suggests, the Indian Ocean likely has the highest average concentration of microplastics in the world right now, but I would preferably like to return to this dataset later in the future to see whether this trend persists with a larger sample size.