benchmarkRuntime {DHARMa}R Documentation

Benchmark runtimes of several functions

Description

Benchmark runtimes of several functions

Usage

benchmarkRuntime(createModel, evaluationFunctions, n)

Arguments

createModel

a function that creates and returns a fitted model

evaluationFunctions

a list of functions that are to be evaluated on the fitted models

n

number of replicates

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

Author(s)

Florian Hartig

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)

[Package DHARMa version 0.4.6 Index]