| variance_function | R Documentation |
Construct a working variance function for variance-aware Michaelis-Menten fitting.
variance_function(model = c("constant", "log", "sqrt", "cuberoot", "power"),
power = NULL, label = NULL)
model |
A built-in model name or a vectorized function of concentration returning one finite, strictly positive numeric variance-shape value per input. |
power |
Optional exponent used when |
label |
Optional non-empty descriptive label for a user-defined function. |
A custom function represents a fixed shape h(S) in
\operatorname{Var}(Y\mid S)=\gamma h(S). It must be deterministic,
pointwise, and vectorized: a value at a concentration must not depend on other
elements of the input vector. It must return a numeric vector of the same length
as its input, not a scalar recycled across observations. Values must be strictly
positive and finite at all fitting and prediction concentrations, including zero
if it is used. Invalid custom outputs cause an error; they are not clipped.
For example, use function(S) rep(1, length(S)) for a constant shape.
All constants captured by a custom function must be fixed, not parameters to be
estimated by fit_mm(). Keep its enclosing environment unchanged between
fitting and prediction/refitting; use a local closure to capture external constants
when needed. label describes the function but does not change its values.
Custom functions are supported by fit_mm(), screen_mm(), and
group_mm(), not currently by cluster_mm().
A function of substrate concentration x.
h_log <- variance_function("log")
h_sqrt <- variance_function("sqrt")
h_log(c(0, 5, 10))
h_sqrt(c(0, 5, 10))
h_custom <- variance_function(function(S) 1 + S / 20,
label = "Var = gamma (1 + S/20)")
h_custom(c(0, 5, 10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.