Learn R Programming

IsoplotR (version 0.6)

weightedmean: Calculate the weighted mean age

Description

Models the data as a Normal distribution with two sources of variance. Estimates the mean and 'overdispersion' using the method of Maximum Likelihood. Computes the MSWD of a Normal fit without overdispersion. Implements Chauvenet's Criterion to detect and reject outliers.

Usage

weightedmean(x, ...)
"weightedmean"(x, detect.outliers = TRUE, plot = TRUE, rect.col = rgb(0, 1, 0, 0.5), outlier.col = rgb(0, 1, 1, 0.5), sigdig = 2, alpha = 0.05, ...)
"weightedmean"(x, detect.outliers = TRUE, plot = TRUE, rect.col = rgb(0, 1, 0, 0.5), outlier.col = rgb(0, 1, 1, 0.5), sigdig = 2, type = 4, cutoff.76 = 1100, cutoff.disc = c(-15, 5), alpha = 0.05, dcu = TRUE, ...)
"weightedmean"(x, detect.outliers = TRUE, plot = TRUE, rect.col = rgb(0, 1, 0, 0.5), outlier.col = rgb(0, 1, 1, 0.5), sigdig = 2, alpha = 0.05, dcu = TRUE, ...)

Arguments

x
a two column matrix of values (first column) and their standard errors (second column) OR an object of class UPb OR an object of class ArAr
...
optional arguments
detect.outliers
Boolean flag indicating whether outliers should be detected and rejected using Chauvenet's Criterion.
plot
Boolean flag indicating whether the function should produce graphical output or return numerical values to the user.
rect.col
the fill colour of the rectangles used to show the measurements or age estimates.
outlier.col
if detect.outliers=TRUE, the outliers are given a different colour.
sigdig
the number of significant digits of the numerical values reported in the title of the graphical output.
alpha
the confidence limits of the error bars/rectangles.
type
scalar indicating whether to plot the $^{207}$Pb/$^{235}$U age (type=1), the $^{206}$Pb/$^{238}$U age (type=2), the $^{207}$Pb/$^{206}$Pb age (type=3), the $^{207}$Pb/$^{206}$Pb-$^{206}$Pb/$^{238}$U age (type=4), or the (Wetherill) concordia age (type=5)
cutoff.76
the age (in Ma) below which the $^{206}$Pb/$^{238}$U and above which the $^{207}$Pb/$^{206}$Pb age is used. This parameter is only used if type=4.
cutoff.disc
two element vector with the maximum and minimum percentage discordance allowed between the $^{207}$Pb/$^{235}$U and $^{206}$Pb/$^{238}$U age (if $^{206}$Pb/$^{238}$U < cutoff.76) or between the $^{206}$Pb/$^{238}$U and $^{207}$Pb/$^{206}$Pb age (if $^{206}$Pb/$^{238}$U > cutoff.76). Set cutoff.disc=NA if you do not want to use this filter.
dcu
propagate decay constant uncertainty?

Value

if PLOT=FALSE, returns a list with the follwing items:mean: a two element vector with the weighted mean and its standard error.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)p.value: the p-value of a Chi-square test with n-1 degrees of freedom, testing the null hypothesis that the underlying population is not overdispersed.valid: vector of Boolean flags indicating which steps are included into the weighted mean calculation

Examples

Run this code
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))
#data(examples)
#weightedmean(examples$ArAr)

Run the code above in your browser using DataLab