calc.h: Calculate the Median Horizontal Distance Between Linear...

View source: R/Francis_bomb_functions.R

calc.hR Documentation

Calculate the Median Horizontal Distance Between Linear Spline and Test Points

Description

calc.h calculates the median horizontal distance between the linear spline line and the set of points defined by test, where the horizontal distance is measured in standard errors. Points whose y-values lie outside the range of the y-values for the line are excluded from teh calculation (because their horizontal distance from the line is undefined).

Usage

calc.h(line, test, age.err, test.x, test.y)

Arguments

line

a list, with components x and y (each an n-vector), containing the series of n points defining the line

test

dataframe representing test data set as described in function calc.bias

age.err, test.x, test.y

character strings representing the names of the columns in test containing the aging error estimates, the x-variable, and the y-variable, respectively.

Value

Returns a numeric value representing the median horizontal distance from the reference line give the test data set.

See Also

Other Bomb Radiocarbon Analyses: bias.plot.BR(), calc.bias(), closest.pt(), get.h.from.bias(), get.nearest(), get.ref.line(), sim.hdist()

Examples

data(snapper)
snapper.red <- snapper[snapper$C14year >= 1955 & snapper$C14year <= 1972, ]
data(bluenose)
bluenose.red <- bluenose[bluenose$C14year >= 1955 &
  bluenose$C14year <= 1972, ]
bluenose.red <- bluenose.red[bluenose.red$C14 >= -506 &
  bluenose.red$C14 <= 94.0, ]
ref <- get.ref.line(snapper.red$C14year, snapper.red$C14)
calc.h(line = ref, test = bluenose.red, age.err = "age.err", test.x =
  "C14year", test.y = "C14")

ballengerj/FishyR documentation built on June 17, 2022, 10:33 p.m.