This function is used to estimate age-at-death in the BAMSAUR shiny app.

BAMSAURshiny(
  wear,
  data = NULL,
  model = "quadratic",
  pop = "MB11",
  interval = "prediction",
  level = 0.68,
  varmod.method = "earth",
  nfold = n - 1,
  ncross = 3,
  mars.int = T
)

Arguments

wear

Numeric. The wear score of an individual. Can be a single value or a vector containing a list of wear scores from multiple individuals.

data

Data frame containing one column for ages-at-death and a second column for the average wear scores. Not required when pop = "MB11" is selected.

model

Character. "linear", "quadratic", "cubic", and "mars" are supported.

pop

Character. Indicates which reference population to use. "MB11" and "other" are supported. When "other" is selected, the data input is required.

interval

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

level

Numeric. Determines the level of confidence or prediction intervals. Is a number between 0 and 1 (not inclusive). 0.68, 0.90, or 0.95 is recommended. The default is set at 0.68.

varmod.method

Method used to build the variance model. See ?earth for more details.

nfold

Number of folds.

ncross

Number of cross validations.

mars.int

Logical. If 'TRUE', uses prediction intervals from the MARS model. Recommended if the data show some heteroscedasticity (but not enough to warrant a MARS model). Default set as 'TRUE'.

Value

a data frame containing the following values:

wear

The wear score(s) initially applied to the function

estimate

Age-at-death estimate(s) calculated from the wear score(s)

range

the age range (+- years) of the estimate, determined by the type and level.

lower

the lower bound of the age interval.

upper

the upper bound of the age interval.

Details

This function uses the "lm" function for the regression models, and "earth" for the MARS models.