ggbgetAgesFit: determine the age range that minimizes the mean squared error

View source: R/ggb.R

ggbgetAgesFitR Documentation

determine the age range that minimizes the mean squared error

Description

Called by ggbcoverageFromYear() whenever exact.ages are not given. This automates what one typically does visually.

Usage

ggbgetAgesFit(
  codi,
  minA = 5,
  maxA = 75,
  minAges = 8,
  lm.method = "tukey",
  opt.method = "r2",
  scale = 1
)

Arguments

codi

data.frame as returbed by ggbMakeColumns()

minA

the lowest age to be included in search

maxA

the highest age to be included in search (the lower bound thereof)

minAges

the minimum number of adjacent ages to be used in estimating

lm.method

character, one of:

  • "oldschool" default sd ratio operation of still unknown origin

  • "lm" or "ols" for a simple linear model

  • "tls", "orthogonal", or "deming" for total least squares

  • "tukey", "resistant", or ""median" for Tukey's resistant line method

opt.method

what kind of residual do we minimize? choices "RMS","logRMS", "ORSS", "logORSS" (experimental)

scale

multiplicative scale factor for the minimized residual

Value

a vector of ages that minimizes the RMSE

See Also

codeggbChooseAges


albinomatheus/toolbox documentation built on June 13, 2024, 5:42 a.m.