mwlSource | R Documentation |
Given parameters describing a meteoric water line in H-O isotope space, generate a posterior sample of unevaporated source water values conditioned on one or more sample values.
mwlSource(obs, MWL = NULL, slope, stype = 1, edist = "unif",
eprior = NULL, ngens=1e4, ncores = 1)
obs |
|
MWL |
numeric. Vector of length 6 containing parameters describing a meteoric water line (see Details). |
slope |
numeric. Vector of length two specifying prior parameters for the evaporation line slope (mean, standard deviation). |
stype |
integer. Line statistic used to constrain the source prior: 1 = confidence interval, 2 = prediction interval (see Details). |
edist |
character. One of |
eprior |
numeric. Vector of length 2 giving prior parameter estimates for the oxygen isotope evaporation effect. For |
ngens |
integer. Number of posterior samples to obtain (per chain). |
ncores |
integer. Number of cores to use for parallel processing. |
The prior distribution of source values is constrained by MWL
, which contains the parameters: slope, intercept, average d18O, sum of squares in d18O, root mean square error, and number of samples for an empirically-determined meteoric water line. This object can be created from a H and O isotope dataset using the function mwl
. The default value (if MWL = NULL
) reflects the Global Meteoric Water Line estimated from a global precipitation compilation in Bowen, et al. (2019). stype
determines how the source uncertainty about the MWL is calculated; the default (1, confidence interval) is appropriate if the source is best represented as an integrated mixture of the samples defining the MWL, whereas option 2 (prediction interval) is appropriate if the source is best represented as a single sample.
If ncores
= 1, three chains will be run on a single core. If ncores
> 1, ncores
chains will be run in parallel on ncores
cores.
Returns an object of class “mwlSource”, a list containing:
summary |
matrix. Summary table of JAGS MCMC results, including parameter posterior distributions and convergence statistics. |
results |
data.frame. Posterior samples of model parameters.
|
Bowen et al. (2019) Isotopes in the water cycle: Regional- to global-Scale patterns and applications. Annual Review of Earth and Planetary Sciences 47 453–479. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1146/annurev-earth-053018-060220")}.
#Prep MWL
O = runif(10, -15, -2)
H = O * 8 + 10 + rnorm(10, 0, 6)
MWL = mwl(data.frame(H, O), plot = FALSE)
#Sample data
obs = iso(-60, -6, 0.5, 0.1, 0)
#Evaporation slope
slope = c(5, 0.3)
#Run and report...likely not converged!
ws = mwlSource(obs, MWL, slope, ngens = 1e3)
ws$summary
#A traceplot
plot(ws$results$source_d18O[1:1000], type = "l")
lines(ws$results$source_d18O[1001:2000], col = 2)
lines(ws$results$source_d18O[2001:3000], col = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.