tef_checkPars: Check for bound hitting and other undesireable outcomes...

View source: R/tef_checkPars.R

tef_checkParsR Documentation

Check for bound hitting and other undesireable outcomes within an optim() call

Description

TEfits internal.

Usage

tef_checkPars(
  err,
  guesses,
  curDat,
  pNames,
  evalFun,
  errFun,
  respVar,
  linkFunX = NA,
  y_lim,
  rate_lim,
  shape_lim,
  penalizeRate,
  paramTerms,
  guessGroups = NULL
)

Arguments

err

Error

guesses

Parameter values

curDat

Data being fit

pNames

Parameter names

evalFun

Function being fit

errFun

Function to calculate error

respVar

Name of the response variable

linkFunX

If relevant, the "x" value for a link function (e.g., Weibull, logistic)

y_lim

Limits to fit values

rate_lim

Limits to rate parameter

shape_lim

If using a Weibull change function, limits to Weibull shape parameter

penalizeRate

Logical. Should error be penalized if rate is extremely close to the bounds?

paramTerms

parameter-level regressions, to be evaluated for checking y_lim and rate_lim

guessGroups

deprecated

Details

Sane boundaries for parameters are the only way that many nonlinear regression optimizations can be identifiable. Fortunately, theory-driven constraints on parameter ranges provide useful a priori restrictions on the possible ranges for parameters and model predictions. This function checks the following:

  • start and asymptote parameters – all models are parameterized in terms of starting and ending values. This ensures that the starting and ending values comply with the y_lim boundaries; y_lim may be user-defined, defined by another model feature (e.g., bernoulli error function is limited to predicted values of 0 or 1; Weibull link thresholds must be above 0).

  • rate parameter – If not user-input, then defined by TEfits::tef_getLinkedFun. Defaults, with exponential change, to a minimum that would provide 50 amount of time, and to a maximum value that would provide 80 functions have limits that, with their respective parameterizations, are intended to imitate the limits of the 3-parameter exponential (i.e., imitate the overall shape of the curve's extremes) These are heuristics. The default values are intended to be flexible while maintaining a sufficiently constrained curve such that both starting asymptote parameters are interpretable (i.e., if the rate parameter, which is a time constant, were to be extremely small, the start parameter could become infinitely large or small). If a time-evolving process occurs on a timescale that cannot be fit by the default boundaries, it is likely that the data is unsufficient to characterize that process.

  • pPrevTime parameter – 4-parameter Power change utilizes a so-called "previous learning time" parameter that assumes that the learning function extents backward through time. This parameter must be greater than 0 and smaller than 1*10^5

Users are highly encouraged to use their own boundaries (e.g., y_lim & rate_lim), given knowledge of a specific dataset, using tef_control.


akcochrane/TEfits documentation built on June 12, 2025, 11:10 a.m.