I have some time series data, where each data point in the time series has a timestamp and a value. For example:
Time 1 value 5
Time 2 Value 7
Time 3 Value 10
Now at a given time X, I want to obtain an approximation on the average of recent values in the time series. For example, consider that the time series is temperature readings for a machine. I want to calculate the average temperature readings in recent days. To do this, I must choose the number of data points to be used to calculate the average.
On the one hand, if I choose to use a smaller number of values such as the two last values of the time series to calculate the average, the average will not be very reliable because these data points may be outliers.
On the other hand, if I choose to use all previous values of the time series, this may not reflect recent trends in the time series, but the average would better tolerate outliers.
Thus, my question is how can a determine a minimum number of data points to calculate an average of recent values in a time series that is considered "reliable". The concept of "reliable" should be expressed in terms of a confidence interval, if possible.
Of course, the concept of "recent values" is fuzzy, but there are certainly some lower bound on the number of data points that should be use to calculate an average reliably.
Just to make my question clearer, I will tell you the solution that I have thought about, which is in my opinion not good. I have though about using the Hoeffding bound ( https://en.wikipedia.org/wiki/Hoeffding%27s_inequality), as it "provides an upper bound on the probability that the sum of independent random variables deviates from its expected value". But I think that it is inappropriate for my problem with a time series as events may not be independent or the time series may not be stationnary. Thus, what could be used as a better technique?
Edit: I have edited the question since some people have decided put the question on hold.