Calculates log randomized predictive p-values (log-RPPs) based on the Importance Sampling Cross-Validation (ISCV) method, using precomputed log cumulative distribution function (log-CDF) and log probability mass function (log-PMF) values.
Value
A numeric vector of length \(N\), giving the log randomized predictive p-values for each observation.
Details
This function implements the Importance Sampling Cross-Validation (ISCV) version of the log randomized predictive p-value (log-RPP) computation. It uses numerically stable log-sum-exp operations to avoid overflow or underflow when summing in log space.
Randomized predictive p-values (\(rpp\)) are computed using uniform random draws \(u_i \sim \text{Uniform}(0,1)\), combined with the model-predicted \(\text{CDF}\) and \(\text{PMF}\) values for each observation and posterior sample. The result is returned in log scale for numerical stability.
Internally, this function:
Generates uniform random values \(u_i\) for each observation.
Computes \(\log(u_i)\) and adds it to \(\log(\text{PMF})\).
Applies numerically stable log-sum-exp operations column-wise.
Values numerically equal to 0 or 1 are replaced by \(\log(1e-5)\) and \(\log(9e-5)\) respectively to keep calculations stable.