In fitting GAMs to some data, my interest is in using inverse estimation to find the value of the predictor $X$ that corresponds to a given value of the response $Y$.
I have written some R code to compute $X$ from $Y$ with corresponding large-sample confidence interval.
My issue now is in using simulation of GAMs to find estimates of bias and standard error for the inverse estimates. However, when I apply bootstrapping, sometimes R throws errors that can't seem to be debugged, such as "replacement has length zero".
Is this problem due to the inherent structure of GAM (in mgcv)?
I read this previous post
Can I use bootstrapping to estimate the uncertainty in a maximum value of a GAM?
and it seems similar to what I would like to be able to do (predict the $X$ given $Y$). This approach uses lpmatrix to simulate from the posterior of the GAM covariates. Can the same be done using jagam (though this approach is in itself unstable)?