Skip to contents

This function calculates PIT residuals for given observed values using a specified cumulative distribution function (CDF). A good set of Probability Integral Transform (PIT) residuals should appear as a random scatter of points roughly centered around 0.5 on a plot, indicating a uniform distribution, with no clear patterns or clustering, essentially looking like "white noise" across the range of predicted values; this signifies that the model fits the data well and the predicted probabilities are reliable.

Usage

residuals_pit_lnorm(x, meanlog, sdlog, qn = TRUE)

Arguments

x

A vector of observed values.

meanlog

Cumulative distribution function (CDF)

sdlog

Additional parameters to pass to the CDF function.

qn

Return the qnorm.

Value

PIT residuals.

Examples

observed <- c(10, 20, 30)
meanlog <- log(c(12, 18, 33))
sdlog <- c(0.1, 0.2, 0.15)
residuals_pit_lnorm(x = observed, meanlog = meanlog, sdlog = sdlog)
#> [1] -1.8232156  0.5268026 -0.6354012
plnorm(q = observed, meanlog = meanlog, sdlog = sdlog)
#> [1] 0.03413537 0.70083465 0.26258339
# plnorm is not available in RTMB