create_ThetaMatrix: Create Theta Matrix

View source: R/create_ThetaMatrix.R

create_ThetaMatrixR Documentation

Create Theta Matrix


Create the Θ matrix with the shared uncertainties that can used as input in, e.g., AgeS_Computation and Age_OSLC14 which is used for the covariance matrix Σ (Combès \& Philippe, 2017)


create_ThetaMatrix(input, output_file = NULL, sigma_s, ...)



character or data.frame (optional): input data frame or file connection to import a CSV-file with the needed information. If nothing is provided the function returns an input template. The argument output_file can be used to write this input template to the file system


character (optional): file path for the output CSV-file, the field separator is hard set to ",". Please use utils::write.table for more flexibility.


numeric (required): named character with values for systematic uncertainties. Those values are lab-specific. Can be set to NULL to remove systematic uncertainties. The order of the named vector is not important, but the naming! Note: some of the uncertainties have a unit, please check details.


further arguments that can be passed to utils::read.table (for the CSV-file import)


The function intends to ease the creation of the Theta matrix, which cannot be created straight forward, e.g., base R functions such as stats::cov. The relationship between the covariance matrix Sigma and Theta is given with

Σ_ij = A_i * A_j * Θ_ij

For details see Combès \& Philippe, 2017 and Guérin et al. (under review).

Input modes

The function supports two different operation modes:

  1. input is left empty: the function returns a data.frame template that can be used as input (the option output_file works as well)

  2. input is fed with a data.frame or a character (file path), the Θ matrix is returned

Input format

The function expects either a CSV-file or a data.frame as input. To create template you can run the function leaving the argument input empty (see example). Please note the format of the input table (data.frame) needs to kept as specified in the template.

The following table lists the meaning of the columns:

SAMPLE_ID sample name -
DR_BETA_K standard error beta-dose rate K Gy/ka
DR_BETA_U standard error beta-dose rate U Gy/ka
DR_BETA_Th standard error beta-dose rate Th Gy/ka
DR_GAMMA_K standard error gamma-dose rate K Gy/ka
DR_GAMMA_U standard error gamma-dose rate U Gy/ka
DR_GAMMA_Th standard error gamma-dose rate Th Gy/ka
DR_GAMMA_TOTAL standard error total gamma-dose rate Gy/ka
DR_TOTAL total dose rate Gy/ka
DR_TOTAL_X standard error total dose rate Gy/ka

Note: All columns can be set to 0 or NA, no column must be left empty! If a value > 0 is provided for DR_GAMMA_TOTAL this value is taken and values in, e.g., DR_GAMMA_K are discarded (set to 0)!

Systematic uncertainties

The following table provides informaton on the named argument that can be provided via the argument sigma_s

s_betaK relative uncertainty K concentration -
s_betaU relative uncertainty U concentration -
s_betaTh relative uncertainty Th concentration -
s_gammaK relative uncertainty K concentration -
s_gammaU relative uncertainty U concentration -
s_gammaTh relative uncertainty Th concentration -
s_gammaDR relative uncertainty gamma-dose rate -
s_CAL relative uncertainty beta-source calibration -
s_intDR absolute uncertainty internal dose rate Gy/ka


A symetric Theta matrix or if input is missing, a data.frame with an input template

Function version


How to cite

Kreutzer, S., 2022. create_ThetaMatrix(): Create Theta Matrix. Function version 0.1.0. In: Christophe, C., Philippe, A., Kreutzer, S., Guerin, G., 2022. BayLum: Chronological Bayesian Models Integrating Optically Stimulated. R package version 0.2.1.


Sebastian Kreutzer, IRAMAT-CRP2A, UMR 5060, CNRS-Université Bordeaux Montaigne (France), based on an 'MS Excel' sheet by Guillaume Guérin, IRAMAT-CRP2A, UMR 5060, CNRS-Université Bordeaux Montaigne (France)


Combès, B., Philippe, A., 2017. Bayesian analysis of individual and systematic multiplicative errors for estimating ages with stratigraphic constraints in optically stimulated luminescence dating. Quaternary Geochronology 39, 24–34. doi: 10.1016/j.quageo.2017.02.003

See Also

AgeS_Computation, Age_OSLC14, utils::read.table, utils::write.table


##(1) return template data.frame (no file output)

## Not run: 
##(2) return template as data.frame + file
file_path <- tempfile(fileext = ".csv")
create_ThetaMatrix(output_file = file_path )

sigma_s =  c(
 s_betaK = 0.010,
 s_betaU = 0.007,
 s_betaTh = 0.006,
 s_gammaK = 0.010,
 s_gammaU = 0.007,
 s_gammaTh = 0.006,
 s_gammaDR = 0.05,
 s_CAL = 0.020,
 s_intDR = 0.030))

## End(Not run)

BayLum documentation built on March 18, 2022, 5:50 p.m.