york_fit: Error-considering linear regression

View source: R/york.R

york_fitR Documentation

Error-considering linear regression

Description

york_fit() calculates the regression parameters of an error-considering linear regression.

Usage

york_fit(x, y, x_err, y_err, r = 0)

Arguments

x

vector of x values.

y

vector of y values. Has to be same the length as x.

x_err

Error on the x values. Has to be same the length as x.

y_err

Error on the y values. Has to be same the length as x.

r

Correlation coefficient of x_err and y_err at each data point. Default: 0 (independent errors). Has to be same the length as x. Optional.

Details

Regression fitting method according to York et al. (2004). The algorithm is described in the appendix of Wacker et al. (2014).

Value

A list with regression parameters:

  • slope and its standard error

  • intercept and its standard error

  • weights of the points (normalized to 1)

  • residual standard error (sigma)

  • R2

  • p-value (two-tailed t-test).

Contributors

Julian Tödter

References

York, D., Evensen, N. M., López Martínez, M., & De Basabe Delgado, J. (2004). Unified equations for the slope, intercept, and standard errors of the best straight line. American Journal of Physics, 72(3), 367-375. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1119/1.1632486")}

Wacker, U., Fiebig, J., Tödter, J., Schöne, B. R., Bahr, A., Friedrich, O., et al. (2014). Empirical calibration of the clumped isotope paleothermometer using calcites of various origins. Geochimica et Cosmochimica Acta, 141, 127-144. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.gca.2014.06.004")}

Examples

york_fit(
  x = c(1, 2, 3),
  y = c(1.1, 1.9, 3.2),
  x_err = c(0.1, 0.2, 0.1),
  y_err = c(0.2, 0.1, 0.2))


isogeochem documentation built on March 31, 2023, 8:30 p.m.