Add a d2y_dx2 column to an existing prediction grid
Source:R/detection_limits.R
enrich_grid_with_d2y.RdComputes \(d^2(\log_{10} y) / d(\log_{10} x)^2\) from the
log10_concentration and predicted_response columns already
present on the grid, using non-uniform central differences.
Value
The input grid with an additional column d2y_dx2.
Boundary points (first and last rows) receive NA.
Details
This function is designed to be called inside predict_grid_freq()
or predict_grid_bayes() immediately after the grid data frame is
constructed, adding the column in-place with zero additional model
evaluations.
When is_log_response = TRUE, the predicted_response column
is already on the \(\log_{10}\) scale, so d2y_dx2 is computed
directly. When is_log_response = FALSE, the column is first
\(\log_{10}\)-transformed before differencing.