I have a set of $n$ observations $O$. I want to calculate the mean of these observations and their confidence interval. I can do this when the observations are iid, by looking up the $t$-table for the required confidence value and then calculate the interval as --
$2t\frac{\sigma}{\sqrt{n}}$
However, if the $i^{th}$ observation of this sequence is related to $(i-1)^{th}$ observation, how do I now define the confidence interval. I believe the iid assumptions are no longer valid.
This is very similar to a time-series problem, where you have Lag-1 correlation among data points. You first need to fit a model to this relationship and then remove it from each data point so you can analyze the residuals, which will hopefully be iid. For example, if $x_2=x_1+\epsilon_1$ where $\epsilon_1 \sim F(\epsilon), (F(\epsilon)$ is arbitrary) then you need to model this as a random walk and then you can calculate the mean value of $\epsilon$, since the residuals will be iid.
In other words, correlations between successive points make your data non-stationary, and hence not iid. You need to compare apples to apples by adjuting for the correlation via some model and examining the residuals of the model using iid-based statistics.