Description Usage Arguments Details Value Author(s) Examples
Simulated sigmoidal qPCR curves are generated from an initial model to which some user-defined homoscedastic or heteroscedastic noise is added. One or more models can then be fit to this random data and goodness-of-fit (GOF) measures are calculated for each of the models. This is essentially a Monte-Carlo approach testing for the best model in dependence to some noise structure in sigmodal models.
1 2 3 4 5 |
object |
an object of class 'pcrfit. |
nsim |
the number of simulated curves. |
error |
the gaussian error used for the simulation. See 'Details'. |
errfun |
an optional function for the error distribution. See 'Details'. |
plot |
should the simulated and fitted curves be displayed? |
fitmodel |
a model or model list to test against the initial model. |
select |
if |
statfun |
a function to be finally applied to all collected GOF measures, default is the average. |
PRESS |
logical. If set to |
... |
other parameters to be passed on to |
The value defined under error
is just the standard deviation added plainly to each y value from the initial model, thus generating a dataset with homoscedastic error. With aid of errfun
, the distribution of the error along the y values can be altered and be used to generate heteroscedastic error along the curve, i.e. as a function of the magnitude.
Example:
errfun = function(y) 1
same variance for all y, as is.
errfun = function(y) y
variance as a function of the y-magnitude.
errfun = function(y) 1/y
variance as an inverse function of the y-magnitude.
For the effect, see 'Examples'.
A list containing the following items:
cyc |
same as in 'arguments'. |
fluoMat |
a matrix with the simulated qPCR data in columns. |
coefList |
a list with the coefficients from the fits for each model, as subitems. |
gofList |
a list with the GOF measures for each model, as subitems. |
statList |
a list with the GOF measures summarized by |
modelMat |
if |
Andrej-Nikolai Spiess
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## Generate initial model.
m1 <- pcrfit(reps, 1, 2, l4)
## Simulate homoscedastic error
## and test l4 and l5 on data.
res1 <- pcrsim(m1, error = 0.2, nsim = 20,
fitmodel = list(l4, l5))
## Not run:
## Use heteroscedastic noise typical for
## qPCR: more noise at lower fluorescence.
res2 <- pcrsim(m1, error = 0.01, errfun = function(y) 1/y,
nsim = 20, fitmodel = list(l4, l5, l6))
## Get 95% confidence interval for
## the models GOF in question (l4, l5, l6).
res3 <- pcrsim(m1, error = 0.2, nsim = 20, fitmodel = list(l4, l5, l6),
statfun = function(y) quantile(y, c(0.025, 0.975)))
res3$statList
## Count the selection of the 'true' model (l4)
## for each of the GOF measures,
## use PRESS statistic => SLOW!
## BIC wins!!
res4 <- pcrsim(m1, error = 0.05, nsim = 10, fitmodel = list(l4, l5, l6),
select = TRUE, PRESS = TRUE)
apply(res4$modelMat, 2, function(x) sum(x == 1))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.