CTS_5_sources: CTS Engine for 5 Sources

View source: R/CTS_5_sources.R

CTS_5_sourcesR Documentation

CTS Engine for 5 Sources

Description

Solves determined linear systems for 4 tracers and 5 sources using Monte Carlo simulation to assess solution dispersion and discriminant capacity.

Usage

CTS_5_sources(source, mixture, iter = 1000, seed = 123456, verbose = TRUE)

quartets(source, mixture, iter = 1000, seed = 123456, verbose = TRUE)

CTS_seeds_quartets(source, mixture, iter = 1000, seed = 123456, verbose = TRUE)

Arguments

source

Data frame of sediment sources containing 5 source rows, tracer mean values, standard deviations, and sample size ('n').

mixture

Data frame of mixture samples containing tracer measurements.

iter

Number of Monte Carlo iterations. Default is 1000.

seed

Integer seed for reproducibility. Default is 123456.

verbose

Logical. Whether to show a progress bar in the console. Default is TRUE.

Value

A data.frame ordered by max_dw (lowest dispersion first) containing:

id

Quartet of tracer names used for the system.

w1, w2, w3, w4, w5

Calculated proportion contributions for Sources 1 through 5.

dw1, dw2, dw3, dw4, dw5

Dispersion uncertainties for Sources 1 through 5 (half 84% - 16% quantile range).

cons

Proportion of Monte Carlo iterations yielding physically valid proportions.

max_dw

Maximum dispersion uncertainty across all five sources.

Examples

# Prepare small dummy datasets for 5 sources and 4 tracers
src <- data.frame(
  ID = c("Src1", "Src2", "Src3", "Src4", "Src5"),
  Tracer1 = c(10.5, 20.2, 5.0, 15.1, 8.4),
  Tracer2 = c(2.1, 8.5, 12.3, 4.2, 6.7),
  Tracer3 = c(0.5, 1.2, 3.4, 0.9, 2.1),
  Tracer4 = c(100, 250, 400, 180, 310),
  Tracer1_SD = c(1.1, 1.8, 0.5, 0.8, 0.6),
  Tracer2_SD = c(0.3, 0.9, 1.1, 0.4, 0.5),
  Tracer3_SD = c(0.1, 0.2, 0.3, 0.1, 0.2),
  Tracer4_SD = c(10, 20, 35, 15, 22),
  n = c(10, 10, 10, 10, 10)
)
mix <- data.frame(ID = "Mix1", Tracer1 = 12.0, Tracer2 = 6.0, Tracer3 = 1.5, Tracer4 = 220)

# Run engine
result <- CTS_5_sources(source = src, mixture = mix, iter = 100, verbose = FALSE)
head(result)


OceanTracer documentation built on Oct. 15, 2026, 5:09 p.m.