ggbgetResidual: calculate the root means square of the error to help find...

View source: R/ggb.R

ggbgetResidualR Documentation

calculate the root means square of the error to help find optimal age range

Description

Called by ggbgetAgesFit() whenever the user does not want to manually determine the age range used to determine registration coverage. Probably no need to be called by top-level users. If a user would rather determine the optimal age range some other way, then look toggbcoverageFromYear()where ggbgetResidual is called and add another condition or make it call something else.

Usage

ggbgetResidual(
  agesi,
  codi,
  lm.method = "oldschool",
  opt.method = "RMSE",
  scale = 1
)

Arguments

agesi

the vector of ages used for this iteration

codi

data.frame as returned by ggbMakeColumns()

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 should we try to minimize when picking age trims? Current options are "RMSE", "ORSS", "MAE", "MAPE", or "r2". Default "r2".

scale

scale factor for the objective

Details

Given a vector of ages and a line fitting method, we take one of several potential residuals. RMSE is the root of the mean squared error, MAE is the mean absolute error, MAPE is the mean absolute proportional error, ORSS is the standard deviation of the orthogonal residuals, and r2 is the r2 of an OLS fit.

Value

the RMSE


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