fitErrorModel | R Documentation |
Fit an error model to reduced replicate data using maximum likelihood estimation (MLE). The model estimates the variance of replicate measurements as a function of the mean, based on a chi-square distribution.
fitErrorModel(
data,
factors,
errorModel = "exp(s0)+exp(srel)*x^2",
par = c(s0 = 1, srel = 0.1),
lower = NULL,
upper = NULL,
plotting = TRUE,
blather = FALSE,
...
)
data |
A data frame containing reduced replicate data. Must include columns "value" (mean of replicates), "sigma" (sample standard deviation), and "n" (number of replicates per condition). |
factors |
Character vector specifying the columns in data that define pooling conditions. The model is fit separately for each unique combination of these factors. |
errorModel |
A character string defining the error model in terms of variance. The mean is referenced as x, e.g., "exp(s0) + exp(srel) * x^2". |
par |
Named numeric vector of initial values for the parameters in errorModel. |
lower |
Optional named numeric vector specifying lower bounds for
parameters. Defaults to |
upper |
Optional named numeric vector specifying upper bounds for
parameters. Defaults to |
plotting |
Logical. If |
blather |
Logical. If |
... |
Additional arguments passed to the optimizer |
The model assumes that the sample variance of replicate measurements
follows a chi-square distribution with n-1
degrees of freedom. The
variance is estimated by maximizing the log-likelihood function derived
from this distribution. Given multiple replicates, the variance can be
modeled as a function of the mean.
The errorModel parameter defines this functional relationship. It should be expressed as a character string, using x to represent the mean.
The optimization is performed using optimr
with the
"L-BFGS-B"
method, which supports bound constraints. If lower
and upper are not specified, the parameters are assumed to be
unconstrained.
If plotting = TRUE, the function produces a log-scale variance plot for each condition, showing the pooled variance, the fitted model, and 68% and 95% confidence bounds.
By default, a data frame is returned, containing the original data
with updated sigma
values estimated from the error model.
If blather = TRUE, additional information is returned, including:
- The fitted parameter values.
- The error model used.
- Confidence intervals for sigma
at 68% and 95% levels.
- Effective pooling conditions.
Wolfgang Mader, Wolfgang.Mader@fdm.uni-freiburg.de
Simon Beyer, simon.beyer@fdm.uni-freiburg.de
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.