Last updated: 2025-04-23
Checks: 6 1
Knit directory:
HairCort-Evaluation-Nist2020/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of
the R Markdown file created these results, you’ll want to first commit
it to the Git repo. If you’re still working on the analysis, you can
ignore this warning. When you’re finished, you can run
wflow_publish to commit the R Markdown file and build the
HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20241016) was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 7240d2e. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish or
wflow_git_commit). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .RData
Ignored: .Rhistory
Ignored: analysis/.DS_Store
Ignored: analysis/.Rhistory
Ignored: data/.DS_Store
Ignored: data/Test3/.DS_Store
Ignored: data/Test4/.DS_Store
Untracked files:
Untracked: data/Test4/Data_cort_values_method_ALL.csv
Unstaged changes:
Modified: analysis/ELISA_Analysis_FinalVals_comparisons_test3_test4.Rmd
Modified: analysis/ELISA_Analysis_FinalVals_test4.Rmd
Modified: analysis/ELISA_Calc_FinalVals_test3.Rmd
Modified: analysis/ELISA_Calc_FinalVals_test4.Rmd
Modified: data/Test3/Data_Cortisol_Processed.csv
Modified: data/Test3/Data_QC_flagged.csv
Modified: data/Test3/Data_cort_values_methodA.csv
Modified: data/Test3/Data_cort_values_methodB.csv
Modified: data/Test3/Data_cort_values_methodC.csv
Deleted: data/Test3/Data_cort_values_methodD.csv
Modified: data/Test4/Data_Cortisol_Processed.csv
Modified: data/Test4/Data_QC_flagged.csv
Modified: data/Test4/Data_cort_values_methodA.csv
Modified: data/Test4/Data_cort_values_methodB.csv
Modified: data/Test4/Data_cort_values_methodC.csv
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown
(analysis/ELISA_Calc_FinalVals_test3.Rmd) and HTML
(docs/ELISA_Calc_FinalVals_test3.html) files. If you’ve
configured a remote Git repository (see ?wflow_git_remote),
click on the hyperlinks in the table below to view the files as they
were in that past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| Rmd | 7240d2e | Paloma | 2025-04-22 | organized files |
| html | 7240d2e | Paloma | 2025-04-22 | organized files |
| Rmd | 82ad928 | Paloma | 2025-04-17 | upd |
| html | 82ad928 | Paloma | 2025-04-17 | upd |
| Rmd | 16ce91c | Paloma | 2025-04-10 | recalc_evaluations |
| html | 16ce91c | Paloma | 2025-04-10 | recalc_evaluations |
| html | bbb70a9 | Paloma | 2025-04-09 | comparing methods |
| Rmd | ccad031 | Paloma | 2025-04-09 | new_calc |
| html | ccad031 | Paloma | 2025-04-09 | new_calc |
| Rmd | 77c2ab5 | Paloma | 2025-04-08 | cleaning test3 |
| html | 77c2ab5 | Paloma | 2025-04-08 | cleaning test3 |
Final cortisol value calculations were conducted using three methods:
Standard Method (Method A): Calculates cortisol concentration without correction for spiked samples.
Spike-Corrected Method (Method B): Adjusts for spiked samples to account for addition of a known amount of cortisol, following Nist et al. 2020.
Sam’s Method (Method C): Adjusts for spiked samples using a different equation
Results: As we see below, the formula used by Nist et al. results in negative values, which would mean that there is no cortisol in original samples. This could be an artifact of an extremely high absorbance level caused by an excessive amount of spike. Non-spiked samples, on the other hand, result in values that are within the range found in similar studies of cortisol in human hair.
| Summary | Nist et al. | (A) Standard | (B) Spike-Corrected | (C) Sam’s |
|---|---|---|---|---|
| Mean cort conc (pg/mg) | — | 16.376 | -0.182 | 9.329 |
| Median cort conc (pg/mg) | — | 10.531 | 4.328 | 9.806 |
| Range cort conc (pg/mg) | — | 2.7 to 58.9 | -29.933 to 11.763 | 2.716 to 22.002 |
| Weight (mg) of my samples | |
|---|---|
| Range | 11 to 37.1 |
| Mean | 23.54 |
| Median | 22.4 |
Conclusions: After accounting for differences in dilution and weight, our results suggest future Assays should use the optimal parameters listed below:
Concerns
Ave_Conc_pg/ml: average ELISA reading per sample in pg/mL
Weight_mg: hair weight in mg
Buffer_nl: assay buffer volume in nL → we convert to mL
Spike: binary indicator (1 = spiked sample)
SpikeVol_uL: volume of spike added in µL
Dilution: dilution factor (already present)
Vol_in_well.tube_uL: total volume in well/tube in µL (for spike correction)
std: standard reading value
extraction: methanol volume ratio = vol added / vol recovered (e.g. 1/0.75 ml)
Input is data with low quality samples flagged, but they get removed before continuing with calculations.
Parameters and unit transformations:
# Define volume of methanol used for cortisol extraction
# vol added / vol recovered (mL)
extraction <- 1.3 / 1
# Reading of spike standard and conversion to ug/dl
std <- (3133 + 3146) / 2 # test 3 backfit
std.r <- std / 10000 # std in ul/dl
# Creating variables in indicated units
df$Buffer_ml <- c(df$Buffer_nl/1000) # dilution (buffer)
df$Ave_Conc_ug.dl <- c(df$Ave_Conc_pg.ml/10000) # Transform to μg/dl from assay output
| Wells | Sample | Category | Binding.Perc | Ave_Conc_pg.ml | Ave_Conc_ug.dl | Weight_mg | Buffer_ml | Spike | SpikeVol_ul | Dilution | TotalVol_well_ul | Failed_samples |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| E5 | 11 | NoSpike | 71.6 | 513.2 | 0.05132 | 17.5 | 0.25 | 0 | 0 | 1 | 50 | NA |
| F5 | 12 | YesSpike | 30.0 | 2728.0 | 0.27280 | 24.1 | 0.25 | 1 | 25 | 1 | 50 | NA |
| G5 | 13 | YesSpike | 32.1 | 2477.0 | 0.24770 | 16.8 | 0.25 | 1 | 25 | 1 | 50 | NA |
Formula:
((A/B) * (C/D) * E * 10,000) = F
##################################
##### Calculate final values #####
##################################
data$Final_conc_pg.mg <- c(
((data$Ave_Conc_ug.dl) / data$Weight_mg) * # A/B *
extraction * # C/D *
data$Buffer_ml * 10000 ) # E * 10000
Summary of all samples
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.716 7.820 10.531 16.376 15.336 58.971
| Wells | Sample | Category | Binding.Perc | Ave_Conc_pg.ml | Ave_Conc_ug.dl | Weight_mg | Buffer_ml | Spike | SpikeVol_ul | Dilution | TotalVol_well_ul | Failed_samples | Final_conc_pg.mg | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 27 | H3 | 6 | YesSpike | 34.7 | 2204.0 | 0.22040 | 13.7 | 0.06 | 1 | 25 | 1 | 50 | NA | 12.54832 |
| 28 | A5 | 7 | YesSpike | 30.5 | 2669.0 | 0.26690 | 16.4 | 0.06 | 1 | 25 | 1 | 50 | NA | 12.69402 |
| 29 | B5 | 8 | NoSpike | 77.8 | 386.8 | 0.03868 | 15.3 | 0.25 | 0 | 0 | 1 | 50 | NA | 8.21634 |
| 30 | C5 | 9 | YesSpike | 30.3 | 2693.0 | 0.26930 | 19.2 | 0.25 | 1 | 25 | 1 | 50 | NA | 45.58464 |
We followed the procedure described in Nist et al. 2020:
“Thus, after pipetting 25μL of standards and samples into the appropriate wells of the 96-well assay plate, we added 25μL of the 0.333ug/dL standard to all samples, resulting in a 1:2 dilution of samples. The remainder of the manufacturer’s protocol was unchanged. We analyzed the assay plate in a Powerwave plate reader (BioTek, Winooski, VT) at 450nm and subtracted background values from all assay wells. In the calculations, we subtracted the 0.333ug/dL standard reading from the sample readings. Samples that resulted in a negative number were considered nondetectable. We converted cortisol levels from ug/dL, as measured by the assay, to pg/mg—based on the mass of hair collected and analyzed using the following formula:
A/B * C/D * E * 10,000 * 2 = F
where - A = μg/dl from assay output; - B = weight (in mg) of collected hair; - C = vol. (in ml) of methanol added to the powdered hair; - D = vol. (in ml) of methanol recovered from the extract and subsequently dried down; - E = vol. (in ml) of assay buffer used to reconstitute the dried extract; 10,000 accounts for changes in metrics; 2 accounts for the dilution factor after addition of the spike; and - F = final value of hair cortisol concentration in pg/mg”
##################################
##### Calculate final values #####
##################################
dSpike$Final_conc_pg.mg <-
ifelse(
dSpike$Spike == 1, ## Only spiked samples
((dSpike$Ave_Conc_ug.dl - (std.r)) / # (A-spike)
dSpike$Weight_mg) # / B
* extraction * # C / D
dSpike$Buffer_ml * 10000 * 2, # E * 10000 * 2
dSpike$Final_conc_pg.mg
)
Summary of all samples
Min. 1st Qu. Median Mean 3rd Qu. Max.
-29.933 -9.370 4.328 -0.182 9.944 11.763
Summary without spiked samples
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.716 5.087 8.874 7.908 10.486 11.763
| Wells | Sample | Category | Binding.Perc | Ave_Conc_pg.ml | Ave_Conc_ug.dl | Weight_mg | Buffer_ml | Spike | SpikeVol_ul | Dilution | TotalVol_well_ul | Failed_samples | Final_conc_pg.mg | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 28 | A5 | 7 | YesSpike | 30.5 | 2669.0 | 0.26690 | 16.4 | 0.06 | 1 | 25 | 1 | 50 | NA | -4.475488 |
| 29 | B5 | 8 | NoSpike | 77.8 | 386.8 | 0.03868 | 15.3 | 0.25 | 0 | 0 | 1 | 50 | NA | 8.216340 |
| 30 | C5 | 9 | YesSpike | 30.3 | 2693.0 | 0.26930 | 19.2 | 0.25 | 1 | 25 | 1 | 50 | NA | -15.115885 |
Developed using Sam’s advice and logic. To facilitate the understanding of what is going on, here I do not transform the output values from pg/ml to ug/dL (as done in A and B).
Step 1: Calculate contribution of spike
X * Y / Z / SPd = SP
# Transforming units
data$SpikeVol_ml <- data$SpikeVol_ul/1000 # X to mL
data$TotalVol_well_ml <- data$TotalVol_well_ul/1000 # Z to mL
# SPd = dilution (in this case, is 1 for all)
# Calculate spike contribution to each sample
## ( Spike vol. x Spike Conc.)
## ------------------------ / dilution = Spike contribution
## Total vol.
data$Spike.cont_pg.ml <- (((data$SpikeVol_ml * std ) / # X * Y /
data$TotalVol_well_ml) / # Z /
data$Dilution) # SPd
summary(data$Spike.cont_pg.ml)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.0 0.0 0.0 627.9 1569.8 1569.8
The reading for standard 1 in this plate is 3139.5
The total contribution of the Spike to each sample is 1569.75 pg/mL
Step 2 : Substract spike and calculate final values
((A - SP)/B) * (C/D) * E * SLd = F
##################################
##### Calculate final values #####
##################################
dSpiked$Final_conc_pg.mg <-
((dSpiked$Ave_Conc_pg.ml - dSpiked$Spike.cont_pg.ml) / # (A - spike)
dSpiked$Weight_mg) * # / B *
extraction * # C / D
dSpiked$Buffer_ml * dSpiked$Dilution # E * Sample dilution
dSpiked[ , c("Ave_Conc_pg.ml", "Buffer_ml","Spike.cont_pg.ml", "Final_conc_pg.mg")]
Ave_Conc_pg.ml Buffer_ml Spike.cont_pg.ml Final_conc_pg.mg
1 513.2 0.25 0.00 9.530857
2 2728.0 0.25 1569.75 15.619554
3 2477.0 0.25 1569.75 17.550967
4 2504.0 0.25 1569.75 22.002264
5 643.6 0.06 0.00 4.183400
6 3196.0 0.06 1569.75 5.420833
7 955.4 0.25 0.00 10.081331
8 3730.0 0.06 1569.75 6.039409
9 2540.0 0.25 1569.75 11.261830
10 2377.0 0.25 1569.75 12.202616
11 793.6 0.25 0.00 10.484553
12 680.2 0.25 0.00 10.836520
13 1991.0 0.06 0.00 7.688020
14 1393.0 0.06 0.00 5.030278
15 839.7 0.25 0.00 11.763039
16 2072.0 0.06 0.00 4.427836
17 2287.0 0.06 1569.75 5.085955
18 2888.0 0.25 1569.75 14.474029
19 1149.0 0.06 0.00 4.227453
20 1197.0 0.25 0.00 10.485849
21 1100.0 0.25 0.00 10.576923
22 1124.0 0.25 0.00 10.290141
23 1062.0 0.25 0.00 11.062500
24 2076.0 0.06 0.00 5.257403
25 2444.0 0.06 0.00 5.493718
26 501.4 0.06 0.00 2.715917
27 2204.0 0.06 1569.75 3.611058
28 2669.0 0.06 1569.75 5.228140
29 386.8 0.25 0.00 8.216340
30 2693.0 0.25 1569.75 19.013346
Summary for all samples:
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.716 5.235 9.806 9.329 11.212 22.002
| Sample | Final_conc_pg.mg | Ave_Conc_pg.ml | Spike.cont_pg.ml | Binding.Perc | Weight_mg | Buffer_ml | SpikeVol_ul | Dilution | TotalVol_well_ul | |
|---|---|---|---|---|---|---|---|---|---|---|
| 21 | 33 | 10.576923 | 1100.0 | 0.00 | 52.3 | 33.8 | 0.25 | 0 | 1 | 50 |
| 22 | 34 | 10.290141 | 1124.0 | 0.00 | 51.7 | 35.5 | 0.25 | 0 | 1 | 50 |
| 23 | 36 | 11.062500 | 1062.0 | 0.00 | 53.2 | 31.2 | 0.25 | 0 | 1 | 50 |
| 24 | 37 | 5.257403 | 2076.0 | 0.00 | 36.1 | 30.8 | 0.06 | 0 | 1 | 50 |
| 25 | 38 | 5.493718 | 2444.0 | 0.00 | 32.5 | 34.7 | 0.06 | 0 | 1 | 50 |
| 26 | 5 | 2.715917 | 501.4 | 0.00 | 72.1 | 14.4 | 0.06 | 0 | 1 | 50 |
| 27 | 6 | 3.611058 | 2204.0 | 1569.75 | 34.7 | 13.7 | 0.06 | 25 | 1 | 50 |
| 28 | 7 | 5.228140 | 2669.0 | 1569.75 | 30.5 | 16.4 | 0.06 | 25 | 1 | 50 |
| 29 | 8 | 8.216340 | 386.8 | 0.00 | 77.8 | 15.3 | 0.25 | 0 | 1 | 50 |
| 30 | 9 | 19.013346 | 2693.0 | 1569.75 | 30.3 | 19.2 | 0.25 | 25 | 1 | 50 |
Final cortisol concentrations not accounting for spike. Tags are sample numbers.
Expected results: a straight horizontal line showing that I obtained same cortisol concentration value in the Y axis, across different sample weights.

Final cortisol concentrations accounting for Spike as instructed in Nist et al. 2020.
Expected results: lower values than in the previous plot for the spiked samples, but not as low as negative samples (for all of them). Spiked and non-spiked samples should be aligned (same concentration across different weights)

Final cortisol concentration values using new method.
Expected results: one unique horizontal line, regardless of
the spiking status and dilution. We see this line for the spiked samples
that were reconstituted using 60 uL (i.e, the most concentrated
samples). Perhaps the 250uL samples, by being more diluted and having a
larger volume, present more variation if the cort distribution within
the well/tube is not homogeneous.
Note that samples seem to be less aligned or more separated
from each other than in previous plots. This is due to a difference in
scale (A has values 0 to 60, while here all values fall between 2.5 and
22.5).


| Version | Author | Date |
|---|---|---|
| 7240d2e | Paloma | 2025-04-22 |
The previous figure shows that:
1 2 3 4 5 6 7
0.2480331 6.2865613 8.2734641 12.7475653 -5.0576169 -3.9068384 0.6974098
8 9 10 11 12 13 14
-3.3224690 1.8991926 2.8893870 1.1477595 1.5316518 -1.6153278 -4.2837116
15 16 17 18 19 20 21
2.4368873 -4.9994132 -4.1474610 5.0992289 -5.0834960 1.0540394 1.1701978
22 23 24 25 26 27 28
0.8704933 1.6755381 -4.1265188 -3.9198489 -6.5433433 -5.6428807 -4.0463224
29 30
-1.0497613 9.7176001
2 3 4 6 8 9 10
3.9860988 6.2660887 10.8606365 -6.1791967 -5.7754974 -0.5578506 0.6933117
17 18 27 28 30
-5.9219728 2.5779474 -7.5257946 -6.0376383 7.6138672
1 5 7 11 12 13 14
2.4895362 -2.2691305 1.6162080 2.6831570 3.4847456 0.3576563 -2.4499596
15 16 19 20 21 22 23
4.1115169 -4.6474885 -3.2099635 1.3462932 1.7906415 1.3218695 2.5545557
24 25 26 29
-3.2077206 -3.3889115 -3.9935406 1.4105351


Error using samples w/0.06 mL buffer
Mean Absolute Error (MAE) 0.06 mL: 0.803
Standard Deviation of Residuals 0.06 mL: 1.153
Error using samples w/0.25 mL buffer
Mean Absolute Error (MAE) 0.25 mL: 2.496
Standard Deviation of Residuals 0.25 mL: 3.383
From this we conclude that using a 60 uL dilution produces more accurate/more consistent results
Error using spiked samples only
Mean Absolute Error (MAE) ALL: 5.333
Standard Deviation of Residuals ALL: 6.312
Error using non-spiked samples only
Mean Absolute Error (MAE) ALL: 2.574
Standard Deviation of Residuals ALL: 2.882
Error using all samples
Mean Absolute Error (MAE) ALL: 3.85
Standard Deviation of Residuals ALL: 4.858
sessionInfo()
R version 4.5.0 (2025-04-11)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.4.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Detroit
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_1.1.4 paletteer_1.6.0 broom_1.0.8 ggplot2_3.5.2
[5] knitr_1.50
loaded via a namespace (and not attached):
[1] sass_0.4.10 generics_0.1.3 tidyr_1.3.1 lattice_0.22-6
[5] stringi_1.8.7 digest_0.6.37 magrittr_2.0.3 evaluate_1.0.3
[9] grid_4.5.0 fastmap_1.2.0 Matrix_1.7-3 rprojroot_2.0.4
[13] workflowr_1.7.1 jsonlite_2.0.0 whisker_0.4.1 backports_1.5.0
[17] rematch2_2.1.2 promises_1.3.2 mgcv_1.9-1 purrr_1.0.4
[21] scales_1.3.0 jquerylib_0.1.4 cli_3.6.4 rlang_1.1.6
[25] munsell_0.5.1 splines_4.5.0 withr_3.0.2 cachem_1.1.0
[29] yaml_2.3.10 tools_4.5.0 colorspace_2.1-1 httpuv_1.6.16
[33] vctrs_0.6.5 R6_2.6.1 lifecycle_1.0.4 git2r_0.36.2
[37] stringr_1.5.1 fs_1.6.6 pkgconfig_2.0.3 pillar_1.10.2
[41] bslib_0.9.0 later_1.4.2 gtable_0.3.6 glue_1.8.0
[45] Rcpp_1.0.14 xfun_0.52 tibble_3.2.1 tidyselect_1.2.1
[49] rstudioapi_0.17.1 farver_2.1.2 nlme_3.1-168 htmltools_0.5.8.1
[53] rmarkdown_2.29 labeling_0.4.3 compiler_4.5.0