I'm currently working with random walks with drift in R, I use the rwf formula from the forecast package and I wonder how the prediction intervals are computed. As I understand it, for the random walk with drift $$\gamma_t=\gamma_{t-1}+a+\epsilon_t$$ where $\epsilon\sim \mathcal{N}(0,\sigma^2)$,
the rwf function takes both uncertainty from the parameter estimate $\hat{a}$ and from the error term into account, but how exactly are they calculated?
I would say that the variance of the $m$th ahead forecast is equal to $$\mathbb{V}\gamma_{n+m}=m^2\frac{\hat{\sigma}^2}{n-1}+m\hat{\sigma}^2$$Then to compute the lower and uppper limits of the prediction band we would write $$\gamma_n+m\hat{a}\pm 1.96 \sqrt{m^2\frac{\hat{\sigma}^2}{n-1}+m\hat{\sigma}^2}$$ but this does not correspond to what the forecast package gives.