A general function for calculating the error in some parameter

Error_general(
  param,
  param_name,
  R_of_param,
  param_of_R,
  Rmin,
  Rmax,
  delta,
  midpoint,
  error_R,
  temp = 295.15
)

Arguments

param

The parameter over which we are calculating error

param_name

The name of the parameter over which we are calculating error

R_of_param

A function that maps from param --> R NOTE: R_of_param must have arguments in the correct ordrer. They should be:

  • "param"

  • "Rmin"

  • "Rmax"

  • "delta"

  • "midpoint"

  • "temperature, in kelvin"

param_of_R

A function that maps from R --> param NOTE: param_of_R must have arguments in the correct order. They should be: #'

  • "R"

  • "Rmin"

  • "Rmax"

  • "delta"

  • "midpoint"

  • "temperature, in kelvin"

Rmin

the minimum possible ratiometric fluorescence

Rmax

the maximum possible ratiometric fluorescence

delta

the ratiometric fluorescence in the first wavelength

midpoint

the sensor's midpoint (e.g. e0 for redox, pKa for pH, pKd for other ligand)

error_R

a function that, given an R, returns the error in that R

temp

the temperature at which measurements were made

Value

A list with (1) 'E', the given redox potential, (2) 'larger_E', the largest possible E, at the given error (3) 'smaller_E', the smallest possible E, at the given error (4) 'max_error' the largest possible difference between the observed and expected E

Examples

Error_general( param = -275, param_name = "E", R_of_param = R_of_E, param_of_R = sensorOverlord::E, Rmin = 1, Rmax = 5, delta = 0.2, midpoint = -275, error_R = function(x) 0.02 * x )
#> $E #> [1] -275 #> #> $larger_E #> [1] -274.2516 #> #> $smaller_E #> [1] -275.7789 #> #> $max_error #> [1] 0.778922 #>