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?
Asked
Active
Viewed 206 times
3

kjetil b halvorsen
- 63,378
- 26
- 142
- 467

Giorgio Spedicato
- 3,444
- 4
- 29
- 39
-
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](https://stats.stackexchange.com/a/191489/1390) – Gavin Simpson Mar 21 '19 at 20:36