Skip to contents

The function produces a histogram from a DHARMa output. Outliers are marked in red.

Usage

# S3 method for class 'DHARMa'
hist(x, breaks = seq(-0.02, 1.02, len = 53),
  col = c(.Options$DHARMaSignalColor, rep("lightgrey", 50),
  .Options$DHARMaSignalColor), main = "Hist of DHARMa residuals",
  xlab = "Residuals (outliers are marked red)", cex.main = 1, ...)

Arguments

x

a DHARMa simulation output (class DHARMa).

breaks

breaks for hist() function.

col

color for histogram bars.

main

plot title.

xlab

plot x-axis label.

cex.main

plot cex.main.

...

other arguments to be passed on to hist().

Details

The function calls hist() to create a histogram of the scaled residuals. Outliers are marked red as default but it can be changed by setting options(DHARMaSignalColor = "red") to a different color. See getOption("DHARMaSignalColor") for the current setting.

Examples

testData = createData(sampleSize = 200, family = poisson(),
                      fixedEffects = c(1,1),
                      randomEffectVariance = 1, numGroups = 10)
testData$Environment2[1] = NA
fittedModel <- glm(observedResponse ~ Environment1 + Environment2,
                   family = "poisson", data = testData)
simulationOutput <- simulateResiduals(fittedModel = fittedModel)

######### main plotting function #############

plot(simulationOutput)

# for all functions, quantreg = T (default) will be more informative
# but slower. Alternative:

plot(simulationOutput, quantreg = FALSE)


#############  Distribution  ######################

plotQQunif(simulationOutput = simulationOutput,
           testDispersion = FALSE,
           testUniformity = FALSE,
           testOutliers = FALSE)


hist(simulationOutput)