# Bootstrap confidence interval of an estimated function

I have a model whose estimation is a function (finite number of points) over an intervalle. I am looking at the sum of each estimated point of the function : $$\hat{\theta} := \sum_{i=0}^k \hat{f}(i)$$ which is my parameter of interest.

Now, if I want a $$95\%$$ CI using resampling, I see two ways to do so:

First, I can do $$P$$ resampling, compute $$P$$ estimated function $$\hat{f}_j$$ and then for each function compute $$\hat{\theta}_j$$ as the sum of this function at each point. A $$95\%$$ CI could then be computed by taking the $$2.5\%$$ and $$97.5\%$$ quantiles of the sample $$(\hat{\theta}_j)$$

An other way to do is to do $$P$$ resampling and compute $$P$$ estimated functions $$\hat{f}_j$$. Then, for each point $$i \in \{0, \dots k\}$$ we can compute the $$95\%$$ confidence interval $$[l_i, u_i]$$ from the sample $$(\hat{f}_j(i))_{0 \leq j \leq P}$$. We then have an $$97.5\%$$ upper function ($$f(i) = u_i$$) as well as a $$2.5\%$$ lower function ($$f(i) = l_i$$). A $$95\%$$ CI for $$\theta$$ could then be computed as the sum at each point of the lower function and upper function.

Those two methods yield very differents CI and I was wondering which one is correct?

My opinion is that the first method is correct but I can't see why the second would not be.

Definitely generate the bootstrap interval for $$\theta$$ based on the distribution of bootstrapped $$\hat{\theta}^{(r)}$$. That's because your goal is obtaining an unbiased estimate of the sampling distribution of $$\hat{\theta}$$. The reason why the second approach probably won't work is:
$$\text{var}(\hat{\theta}) = \text{var} \left(\sum_{i=1}^k \hat{f}(j)\right) \ne \sum_{i=1}^k \text{var}\left(\hat{f}(i)\right)$$