I would like to know how to get confidence intervals of function of predictions of a gam (via R package mgcv) model. In detail, I got $h\left( y_i \right) = E\left(y_i\right)$ and $std\left(y_i\right)$, that is the estimate of the expected value and its standard error of prediction for any $i$-th observation. Also, I computed $f\left( y_i, y_j\right)= y_i- y_j$ and $g\left( y_i, y_j\right)= y_i/y_j$. I would like to compute the confidence intervals for $f$ and $g$. I know that maybe the (multivariate) delta method might help, but how to perform it? In particular, how to get the covariance of $h\left( y_i \right)$ and $h\left( y_j \right)$ estimates? Is it possible to have and example with R?

  • $\begingroup$ I think what you want to do can be done by working on the link scale of the GAM and simulating from the posterior distribution of the fitted model, estimating your functions on the values returned from the posterior draws, which forms a posterior for $f$ or $g$, and then summarise that posterior distribution via, say the mean and upper and lower 0.025th probability quantiles. An example of this is in this question $\endgroup$ – Gavin Simpson Mar 21 '19 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.