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.mars(object, data, type = "earth", level = 0.68, ...)
object | Object of type 'lm' or 'earth'. Linear, quadratic, and cubic regression is supported. |
---|---|
data | Data frame containing the data used to obtain the regression model used in the 'object' field. Only necessary for 'earth' objects. |
type | Character. The type of prediction. "link", "response", or "earth". |
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. |
... | Additional arguments can be passed to the 'earth' function. See ?earth for more details. |
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.
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.