This function can be used to perform leave-on-out cross validation on regression models, and calculate the accuracy of a sample using the 'rstandard' and 'predict' functions.

BAMcv.lm(object, interval = "prediction", level = 0.68)

Arguments

object

Object of type 'lm' or 'earth'. Linear, quadratic, and cubic regression is supported.

interval

Character. The type of age interval used. Can be either "prediction" or "confidence" intervals.

level

Numeric. Determines the level of confidence or prediction intervals. Can be any number between 0 and 1 (not inclusive), but one of 0.68, 0.90, or 0.95 is recommended.

Value

Returns a list containing the following:

out

the data from the LOOCV, including known age, estimated age, difference between estimated and known ages, and the lower and upper age range.

accuracy

The percentage of estimates whose range contains the known age.

accuracy.1

The percentage of estimates falling within one year of the known age.

accuracy.2

The percentage of estimates falling within two years of the known age.

Details

The main use of this function is within the BAMSAUR.bff function, but can also be used as a stand-alone function. The level of accuracy is determined by the type and level of the age intervals. Accuracy is also determined by the percentage of cases that fall within 1 and 2 years of the age estimate, which is independent of the age interval size.