york: Linear regression of X,Y-variables with correlated errors

View source: R/york.R

yorkR Documentation

Linear regression of X,Y-variables with correlated errors

Description

Implements the unified regression algorithm of York et al. (2004) which, although based on least squares, yields results that are consistent with maximum likelihood estimates of Titterington and Halliday (1979).

Usage

york(dat, alpha = 0.05, plot = TRUE, fill = NA, ...)

Arguments

dat

a 4 or 5-column matrix with the X-values, the analytical uncertainties of the X-values, the Y-values, the analytical uncertainties of the Y-values, and (optionally) the correlation coefficients of the X- and Y-values.

alpha

cutoff value for confidence intervals.

plot

logical. If true, creates a scatter plot of the data with the best fit line shown on it.

fill

the fill colour of the error ellipses. For additional plot options, use the IsoplotR package.

...

optional arguments for the scatter plot.

Details

Given n pairs of (approximately) collinear measurements X_i and Y_i (for 1 ≤q i ≤q n), their uncertainties s[X_i] and s[Y_i], and their covariances cov[X_i,Y_i], the york function finds the best fitting straight line using the least-squares algorithm of York et al. (2004). This algorithm is modified from an earlier method developed by York (1968) to be consistent with the maximum likelihood approach of Titterington and Halliday (1979).

Value

A two-element list of vectors containing:

coef

the intercept and slope of the straight line fit

cov

the covariance matrix of the coefficients

References

Titterington, D.M. and Halliday, A.N., 1979. On the fitting of parallel isochrons and the method of maximum likelihood. Chemical Geology, 26(3), pp.183-195.

York, Derek, et al., 2004. Unified equations for the slope, intercept, and standard errors of the best straight line. American Journal of Physics 72.3, pp.367-375.

Examples

data(rbsr,package='geostats')
fit <- york(rbsr)

geostats documentation built on Jan. 7, 2023, 5:32 p.m.

Related to york in geostats...