Last chance! 50% off unlimited learning
Sale ends in
This function tests
testQuantiles(simulationOutput, predictor = NULL, quantiles = c(0.25, 0.5,
0.75), plot = T)
an object of class DHARMa with simulated quantile residuals, either created via simulateResiduals
or by createDHARMa
for simulations created outside DHARMa
an optional predictor variable to be used, instead of the predicted response (default)
the quantiles to be tested
if T, the function will create an additional plot
The function fits quantile regressions (via package qgam) on the residuals, and compares their location to the expected location (because of the uniform distributionm, the expected location is 0.5 for the 0.5 quantile).
A significant p-value for the splines means the fitted spline deviates from a flat line at the expected location (p-values of intercept and spline are combined via Benjamini & Hochberg adjustment to control the FDR)
The p-values of the splines are combined into a total p-value via Benjamini & Hochberg adjustment to control the FDR.
testResiduals
, testUniformity
, testDispersion
, testZeroInflation
, testGeneric
, testTemporalAutocorrelation
, testSpatialAutocorrelation
, testOutliers
# NOT RUN {
testData = createData(sampleSize = 200, overdispersion = 0.0, randomEffectVariance = 0)
fittedModel <- glm(observedResponse ~ Environment1, family = "poisson", data = testData)
simulationOutput <- simulateResiduals(fittedModel = fittedModel)
# run the quantile test
x = testQuantiles(simulationOutput)
x # the test shows a combined p-value, corrected for multiple testing
x$pvals # pvalues for the individual quantiles
x$qgamFits # access the fitted quantile regression
summary(x$qgamFits[[1]]) # summary of the first fitted quantile
# possible to test user-defined quantiles
testQuantiles(simulationOutput, quantiles = c(0.7))
# example with missing environmental predictor
fittedModel <- glm(observedResponse ~ 1 , family = "poisson", data = testData)
simulationOutput <- simulateResiduals(fittedModel = fittedModel)
testQuantiles(simulationOutput, predictor = testData$Environment1)
# the quantile test is automatically performed in
# }
# NOT RUN {
plot(simulationOutput)
plotResiduals(simulationOutput)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab