weightedmean {IsoplotR} | R Documentation |
Calculate the weighted mean age
Description
Averages heteroscedastic data either using the ordinary weighted mean, or using a random effects model with two sources of variance. Computes the MSWD of a normal fit without overdispersion. Implements a modified Chauvenet criterion to detect and reject outliers. Only propagates the systematic uncertainty associated with decay constants and calibration factors after computing the weighted mean isotopic composition. Does not propagate the uncertainty of any initial daughter correction, because this is neither a purely random or purely systematic uncertainty.
Usage
weightedmean(x, ...)
## Default S3 method:
weightedmean(
x,
from = NA,
to = NA,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'other'
weightedmean(
x,
from = NA,
to = NA,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'UPb'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
type = 4,
cutoff.76 = 1100,
oerr = 3,
cutoff.disc = discfilter(),
exterr = FALSE,
ranked = FALSE,
common.Pb = 0,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'PbPb'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
common.Pb = 2,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'ThU'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
ranked = FALSE,
Th0i = 0,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'ArAr'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
ranked = FALSE,
i2i = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'KCa'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
ranked = FALSE,
i2i = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'ThPb'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
ranked = FALSE,
i2i = TRUE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'ReOs'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
ranked = FALSE,
i2i = TRUE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'SmNd'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
ranked = FALSE,
i2i = TRUE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'RbSr'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
i2i = TRUE,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'LuHf'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
i2i = TRUE,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'UThHe'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
## S3 method for class 'fissiontracks'
weightedmean(
x,
random.effects = FALSE,
detect.outliers = TRUE,
plot = TRUE,
from = NA,
to = NA,
levels = NA,
clabel = "",
rect.col = c("#00FF0080", "#FF000080"),
outlier.col = "#00FFFF80",
sigdig = 2,
oerr = 3,
exterr = FALSE,
ranked = FALSE,
hide = NULL,
omit = NULL,
omit.col = NA,
...
)
Arguments
x |
a two column matrix of values (first column) and their
standard errors (second column) OR an object of class
|
... |
optional arguments |
from |
minimum y-axis limit. Setting |
to |
maximum y-axis limit. Setting |
random.effects |
if if |
detect.outliers |
logical flag indicating whether outliers should be detected and rejected using Chauvenet's Criterion. |
plot |
logical flag indicating whether the function should produce graphical output or return numerical values to the user. |
levels |
a vector with additional values to be displayed as different background colours of the plot symbols. |
clabel |
label of the colour legend |
rect.col |
Fill colour for the measurements or age estimates. This can
either be a single colour or multiple colours to form a colour
ramp (to be used if a single colour: multiple colours: a colour palette: a reversed palette: For empty boxes, set |
outlier.col |
if |
sigdig |
the number of significant digits of the numerical values reported in the title of the graphical output. |
oerr |
indicates whether the analytical uncertainties of the output are reported in the plot title as:
|
ranked |
plot the aliquots in order of increasing age? |
hide |
vector with indices of aliquots that should be removed from the weighted mean plot. |
omit |
vector with indices of aliquots that should be plotted but omitted from the weighted mean calculation. |
omit.col |
colour that should be used for the omitted aliquots. |
type |
scalar indicating whether to plot the
|
cutoff.76 |
the age (in Ma) below which the
|
cutoff.disc |
discordance cutoff filter. This is an object of
class |
exterr |
propagate decay constant uncertainties? |
common.Pb |
common lead correction:
|
Th0i |
initial
|
i2i |
‘isochron to intercept’: calculates the initial
(aka ‘inherited’, ‘excess’, or ‘common’) Note that choosing this option introduces a degree of circularity in the weighted age calculation. In this case the weighted mean plot just serves as a way to visualise the residuals of the data around the isochron, and one should be careful not to over-interpret the numerical output. |
Details
Let \{t_1, ..., t_n\}
be a set of n age estimates
determined on different aliquots of the same sample, and let
\{s[t_1], ..., s[t_n]\}
be their analytical
uncertainties. IsoplotR
then calculates the weighted mean of
these data using one of two methods:
The ordinary error-weighted mean:
\mu = \sum(t_i/s[t_i]^2)/\sum(1/s[t_i]^2)
A random effects model with two sources of variance:
\log[t_i] \sim N(\log[\mu], \sigma^2 = (s[t_i]/t_i)^2 + \omega^2 )
where
\mu
is the mean,\sigma^2
is the total variance and\omega
is the 'overdispersion'. This equation can be solved for\mu
and\omega
by the method of maximum likelihood.
IsoplotR uses a modified version of Chauvenet's criterion for outlier detection:
Compute the error-weighted mean (
\mu
) of then
age determinationst_i
using their analytical uncertaintiess[t_i]
For each
t_i
, compute the probabilityp_i
that that|t-\mu|>|t_i-\mu|
fort \sim N(\mu, s[t_i]^2 MSWD)
(ordinary weighted mean) or\log[t] \sim N(\log[\mu],s[t_i]^2+\omega^2)
(random effects model)Let
p_j \equiv \min(p_1, ..., p_n)
. Ifp_j<0.05/n
, then reject the j^{th}
date, reducen
by one (i.e.,n \rightarrow n-1
) and repeat steps 1 through 3 until the surviving dates pass the third step.
If the analytical uncertainties are small compared to the scatter
between the dates (i.e. if \omega \gg s[t]
for all i
),
then this generalised algorithm reduces to the conventional
Chauvenet criterion. If the analytical uncertainties are large and
the data do not exhibit any overdispersion, then the heuristic
outlier detection method is equivalent to Ludwig (2003)'s ‘2-sigma’
method.
The uncertainty budget of the weighted mean does not include the uncertainty of the initial daughter correction (if any). This uncertainty is neither a purely systematic nor a purely random uncertainty and cannot easily be propagated with conventional geochronological data processing algorithms. This caveat is especially pertinent to chronometers whose initial daughter composition is determined by isochron regression. You may note that the uncertainties of the weighted mean are usually much smaller than those of the isochron. In this case the isochron errors are more meaningful, and the weighted mean plot should just be used to inspect the residuals of the data around the isochron.
Value
Returns a list with the following items:
- mean
a two or three element vector with:
t
: the weighted mean. An asterisk is added to the plot title if the initial daughter correction is based on an isochron regression, to mark the circularity of using an isochron to compute a weighted mean.s[t]
: the standard error of the weighted mean, excluding the uncertainty of the initial daughter correction. This is because this uncertainty is neither purely random nor purely systematic.- disp
a two-element vector with the (over)dispersion and its standard error.
- mswd
the Mean Square of the Weighted Deviates (a.k.a. ‘reduced Chi-square’ statistic)
- df
the number of degrees of freedom of the Chi-square test for homogeneity (
df=n-1
, wheren
is the number of samples).- p.value
the p-value of a Chi-square test with
df
degrees of freedom, testing the null hypothesis that the underlying population is not overdispersed.- valid
vector of logical flags indicating which steps are included into the weighted mean calculation
- plotpar
list of plot parameters for the weighted mean diagram, including
mean
(the mean value),ci
(a grey rectangle with the (1 s.e., 2 s.e. or 100[1-\alpha
]%, depending on the value ofoerr
) confidence interval ignoring systematic errors),ci.exterr
(a grey rectangle with the confidence interval including systematic errors),dash1
anddash2
(lines marking the confidence interval augmented by\sqrt{mswd}
overdispersion ifrandom.effects=FALSE
), and marking the confidence limits of a normal distribution whose standard deviation equals the overdispersion parameter ifrandom.effects=TRUE
).
See Also
Examples
ages <- c(251.9,251.59,251.47,251.35,251.1,251.04,250.79,250.73,251.22,228.43)
errs <- c(0.28,0.28,0.63,0.34,0.28,0.63,0.28,0.4,0.28,0.33)
weightedmean(cbind(ages,errs))
attach(examples)
weightedmean(LudwigMean)