fitErrorModel: Fit an error model

Description Usage Arguments Details Value Author(s)

View source: R/statistics.R

Description

Fit an error model to reduced replicate data, see reduceReplicates.

Usage

1
2
3
4
5
6
7
8
9
fitErrorModel(
  data,
  factors,
  errorModel = "exp(s0)+exp(srel)*x^2",
  par = c(s0 = 1, srel = 0.1),
  plotting = TRUE,
  blather = FALSE,
  ...
)

Arguments

data

Reduced replicate data, see reduceReplicates. Need columns "value", "sigma", "n".

factors

data is pooled with respect to the columns named here, see Details.

errorModel

Character vector defining the error model in terms of the variance. Use x to reference the independend variable, see Details.

par

Inital values for the parameters of the error model.

plotting

If TRUE, a plot of the pooled variance together with the fit of the error model is shown.

blather

If TRUE, additional information is returned, such as fit parameters and sigmaLS (original sigma given in input data).

...

Parameters handed to the optimizer optim.

Details

The variance estimator using n-1 data points is chi^2 distributed with n-1 degrees of freedom. Given replicates for consecutive time points, the sample variance can be assumed a function of the sample mean. By defining an error model which must hold for all time points, a maximum likelihood estimator for the parameters of the error model can be derived. The parameter errorModel takes the error model as a character vector, where the mean (independent variable) is refered to as x.

It is desireable to estimate the variance from many replicates. The parameter data must provide one or more columns which define the pooling of data. In case more than one column is announced by factors, all combinations are constructed. If, e.g., factors = c("condition", "name") is used, where "condition" is "a", "b", "c" and repeating and "name" is "d", "e" and repeating, the effective conditions used for pooling are "a d", "b e", "c d", "a e", "b d", and "c e".

By default, a plot of the pooled data, sigma and its confidence bound at 68% and 95% is shown.

Value

Returned by default is a data frame with columns as in data, but with the sigma values replaced by the derived values, obtained by evaluating the error model with the fit parameters.

If the blather = TRUE option is chosen, fit values of the parameters of the error model are appended, with the column names equal to the parameter names. The error model is appended as the attribute "errorModel". Confidence bounds for sigma at confidence level 68% and 95% are calculated, their values come next in the returned data frame. Finally, the effective conditions are appended to easily check how the pooling was done.

Author(s)

Wolfgang Mader, Wolfgang.Mader@fdm.uni-freiburg.de


dMod documentation built on Jan. 27, 2021, 1:07 a.m.