knitr::opts_chunk$set(echo = FALSE, message = FALSE)
library(tidyverse) library(here) library(amstools) library(HybridGIS) options(digits = 4) options(scipen = 3)
Data reduction and analysis for carbonate samples run on May 28, 2021. Includes C-1, C-2, and test shell carbonates from Simon Pendleton. This version compares the effect of including or discarding outliers.
#Raw AMS data results file path file <- here("data/USAMS052621R.txt") # Date samples run (needed to separate other experiments with this wheel/targets) date <- as.Date("2021-05-28") # Positions of normalizing standards standards <- c(5, 8, 13, 17) # Positions of blanks for blank correction blanks <- c(6, 9, 11)
r standards
for normalization.r blanks
for blank correction.Data reduction proceeds as follows:
df <- get_hgis_data(file, date, standards)
df %>% filter(!(Pos %in% 1:4)) %>% plot_hgis_time(normFm, ce*normFm) + ggtitle("Sample ratio vs. time")
df %>% filter(!(Pos %in% 1:4)) %>% plot_hgis_time(he12C) + ggtitle("Sample current vs time")
# The data without outliers df_sum <- sum_hgis_targets(df) %>% norm_hgis() %>% blank_cor_hgis(blanks = c(6, 9, 11)) %>% mutate(outliers_dropped = TRUE) # The data with outliers df_sum_ol <- sum_hgis_targets(df, remove_outliers = FALSE) %>% norm_hgis() %>% blank_cor_hgis(blanks = c(6, 9, 11)) %>% mutate(outliers_dropped = FALSE) df_all <- rbind(df_sum, df_sum_ol)
df_all %>% filter(as.numeric(Pos) > 4) %>% mutate(sig_normFm = max_err * normFm) %>% select(Pos, Sample.Name, outliers_dropped, he12C, n_runs, fm_corr, sig_fm_corr) %>% arrange(Sample.Name) %>% knitr::kable() # gt::gt()
df_all %>% filter(as.numeric(Pos) > 4) %>% ggplot(aes(Sample.Name, fm_corr, color = outliers_dropped)) + geom_pointrange(aes(ymin = fm_corr - sig_fm_corr, ymax = fm_corr + sig_fm_corr), size = 0.1) + theme(axis.text.x = element_text(angle = 45, hjust=1)) + labs(x = NULL, y = "Fraction Modern")
Compare results for samples with more than one replicate.
df_all %>% filter(as.numeric(Pos) > 4) %>% mutate(Name = str_remove(Sample.Name, "_.$")) %>% group_by(Name, outliers_dropped) %>% filter(n() > 1) %>% summarize(across(c(he12C, fm_corr, sig_fm_corr), list(mean = mean, sd = sd)), N = n()) %>% knitr::kable()
cons <- df_all %>% filter(as.numeric(Pos) > 4, !is.na(fm_consensus)) %>% select(Sample.Name, outliers_dropped, fm_consensus, fm_corr, sig_fm_corr) %>% mutate(Fm_diff = fm_corr - fm_consensus, sigma = amstools::sigma(fm_corr, fm_consensus, sig_fm_corr)) %>% arrange(Sample.Name) knitr::kable(cons)
Mean error, difference from consensus, and sigma with and without outliers.
cons %>% group_by(outliers_dropped) %>% summarize(across(c(sig_fm_corr, Fm_diff, sigma), mean))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.