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

Description Usage Arguments Details Value References See Also Examples

View source: R/york.R

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

1
york(x, alpha = 0.05)

Arguments

x

a 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 the correlation coefficients of the X- and Y-values.

alpha

cutoff value for confidence intervals

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). It computes the MSWD as a measure of under/overdispersion. Overdispersed datasets (MSWD>1) can be dealt with in the same three ways that are described in the documentation of the isochron function.

Value

A four-element list of vectors containing:

a

the intercept of the straight line fit and its standard error

b

the slope of the fit and its standard error

cov.ab

the covariance of the slope and intercept

mswd

the mean square of the residuals (a.k.a ‘reduced Chi-square’) statistic

df

degrees of freedom of the linear fit (2n-2)

p.value

p-value of a Chi-square value with df degrees of freedom

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.

See Also

data2york, titterington, isochron, ludwig

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
   X <- c(1.550,12.395,20.445,20.435,20.610,24.900,
          28.530,50.540,51.595,86.51,106.40,157.35)
   Y <- c(.7268,.7849,.8200,.8156,.8160,.8322,
          .8642,.9584,.9617,1.135,1.230,1.490)
   n <- length(X)
   sX <- X*0.01
   sY <- Y*0.005
   rXY <- rep(0.8,n)
   dat <- cbind(X,sX,Y,sY,rXY)
   fit <- york(dat)
   covmat <- matrix(0,2,2)
   plot(range(X),fit$a[1]+fit$b[1]*range(X),type='l',ylim=range(Y))
   for (i in 1:n){
       covmat[1,1] <- sX[i]^2
       covmat[2,2] <- sY[i]^2
       covmat[1,2] <- rXY[i]*sX[i]*sY[i]
       covmat[2,1] <- covmat[1,2]
       ell <- ellipse(X[i],Y[i],covmat,alpha=0.05)
       polygon(ell)
   }

Example output



IsoplotR documentation built on Dec. 9, 2018, 1:04 a.m.