find_zero: Find when an increasing function observed with noise crosses...

Description Usage Arguments Value Examples

View source: R/internal.R

Description

Find the smallest positive integer x-value larger than in initial value for which an approximately monotonic function f is nonnegative. This is an internal function used in general.fi.samplesize. The argument is increased exponentially until it becomes nonnegative, then a binary search is performed.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
find_zero(
  f,
  x.init = 10L,
  fz.verbose = FALSE,
  D = 1,
  gamma = 0.6,
  burnin_dur = 16,
  eps = 0.1,
  proj = function(a) a,
  limits = c(1, 9999999),
  init.step = TRUE
)

Arguments

f

a function with one argument

x.init

the initial value towards finding the zero of f

fz.verbose

a logical value for whether to print status updates while running

D

an internal argument controlling the step size in Ruppert-Polyak averaging

gamma

the power of n^-1 in gradient descent

burnin_dur

the number of iterations of SGD to burn in before there's checks for the average to converge

eps

a parameter to control the error. The smaller is it, the more precise the output but the longer the function will take to run.

proj

a function to project/map the argument of the function onto the functions domain

limits

a length two numeric vector with the first entry being the lower bound and the second being an upper bound.

Value

the argument of f which satisfies the desired conditions.

Examples

1
FragilityTools:::find_zero(function(x) x - 100 + rnorm(1), fz.verbose = FALSE)

brb225/FragilityTools documentation built on Jan. 21, 2022, 1:26 a.m.