# NOT RUN {
## 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))
# }
Run the code above in your browser using DataLab