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?