
Calculate Probability Integral Transform (PIT) residuals
Source:R/residuals.R
residuals_pit_lnorm.RdThis 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.
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