Benchmark runtimes of several functions
Details
This is a small helper function designed to benchmark runtimes of several operations that are to be performed on a list of fitted models. In the example, this is used to benchmark the runtimes of several DHARMa tests.
Examples
createModel = function(){
testData = createData(family = poisson(), overdispersion = 1,
randomEffectVariance = 0)
fittedModel <- glm(observedResponse ~ Environment1, data = testData, family = poisson())
return(fittedModel)
}
a = function(m){
testUniformity(m, plot = FALSE)$p.value
}
b = function(m){
testDispersion(m, plot = FALSE)$p.value
}
c = function(m){
testDispersion(m, plot = FALSE, type = "PearsonChisq")$p.value
}
evaluationFunctions = list(a,b, c)
benchmarkRuntime(createModel, evaluationFunctions, 2)
#> [1] 0.019 0.031 0.001