CTS_2_sources: CTS Engine for 2 Sources

View source: R/CTS_2_sources.R

CTS_2_sourcesR Documentation

CTS Engine for 2 Sources

Description

Solves determined systems for 1 tracer and 2 sources to assess solution dispersion and discriminant capacity.

Usage

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

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

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

Arguments

source

Data frame of sediment sources containing source means, standard deviations, and sample sizes.

mixture

Data frame of mixture samples.

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

Tracer name identifier.

w1, w2

Calculated proportion contributions for Source 1 and Source 2.

dw1, dw2

Dispersion uncertainties for Source 1 and Source 2 (half 84% - 16% quantile range).

cons

Proportion of Monte Carlo iterations yielding physically valid proportions between 0 and 1.

max_dw

Maximum dispersion uncertainty across both sources.

Examples

# Prepare small dummy datasets
src <- data.frame(
  ID = c("Src1", "Src2"),
  Tracer1 = c(10.5, 20.2),
  Tracer1_SD = c(1.1, 1.8),
  n = c(10, 10)
)
mix <- data.frame(ID = "Mix1", Tracer1 = 15.0)

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


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