# estimating the mean of constant + noise

(This is almost certainly covered in Statistics 101, but I missed that class..)

I have a real-world sampled signal $$S[t]$$ that is a constant $$\hat{S}$$ plus some noise $$\epsilon[t]$$. My goal is to find $$\hat{S}$$ with some high degree of confidence.

Intuitively: If I take one sample of $$S$$, I cannot extract $$\hat{S}$$. If I take an infinite amount of samples, I can perfectly reconstruct $$\hat{S}$$ (but that takes a while to compute ;). After $$n$$ samples, I can estimate $$\hat{S}$$, and my confidence in the estimation will increase as I take more samples.

I'd like to take enough samples so that the estimation of $$\hat{S}$$ is "good enough".

So: is there a function that describes the confidence in the estimate of $$\hat{S}$$ after $$n$$ samples?

## addendum

From the comments, I realize I should have stated this up front:

The noise has a flat PDF. In other words, the noise is evenly distributed with some finite bounds. (It's clear why that makes a difference...)

• "Good enough" in terms of what? – Tim Mar 17 at 12:35
• Do you know anything about the noise? Can you say how you'd want to measure deviation of $\hat{S}$ from the true signal' – Glen_b Mar 17 at 12:53
• Also note: you can make things display as equations by enclosing them in $signs, e.g. $\hat{S}$ will display as$\hat{S}$, or $\epsilon_t$ will display as$\epsilon_t$– Weiwen Ng Mar 18 at 21:08 • @WeiwenNg Thanks for the tip. Better? – fearless_fool Mar 20 at 0:47 ## 1 Answer This very much depends. ## Problem cases If your noise does not have mean 0, then no amount of samples will help you uncover $$\hat S$$, because you cannot differentiate $$\hat S$$ from the mean of the noise. If the signal you sample has an autocorrelated structure, you will have to compensate for this structure, meaning that you have to know what this structure looks like. The same is true for other sources of heterogeneity. If you don't know this structure, you can't determine a confidence interval for your estimator. ## Ideally If the noise is IID with mean 0, then you can build upon the central limit theorem (CLT). In short, this theorem states that for large enough sample size $$n$$, the sample mean is an approximately' normally distributed variable centered around the true mean, with variance $$1/n$$. The problem with the central limit theorem is that you don't know exactly how large $$n$$ has to be, before you are satisfied with the approximation. This depends on the exact (and probably unknown) distribution of your noise. In some softer sciences it is common practice to be satisfied $$n=7$$, but most hard scientists will agree that considering $$n=7$$ satisfactory is a poor joke. The gist of it is: Take $$n$$ as large as you reasonably can before applying the CLT. The larger $$n$$ is, the more people are inclined to believe your conclusion. ## Even better If you know the distribution of the noise, then you can use the distribution of the sum of noise observations to get an exact answer. Since your noise is uniform, the mean of $$n$$ samples will follow the Irwin-Hall aka uniform-sum distribution scaled by $$n$$. Mathematically: If sample $$S_i$$ is uniform$$[a,b]$$ distributed, then $$\sum_{i=1}^n(S_i-a)/(b-a)$$ follows the Irwin-Hall$$(n)$$ distribution. Now, you can use the CDF of this distribution to get your answer. • ah right! see "addendum" in the original post: the noise is evenly distributed with some (unknown) bounds. – fearless_fool Mar 17 at 14:40 • @fearless_fool I edited my answer accordingly. That is a pretty interesting noise process. – Sebastiaan Mar 19 at 20:02 • I know that the noise is evenly distributed, but I don't know its magnitude (i.e. I don't know [a, b]). Even with Irwin-Hall, I'm having trouble seeing how that helps me find n... – fearless_fool Mar 20 at 0:29 • No offence fearless_fool, but you are basically asking me to repeat statistics 201 for you, which I am not going to do. 1) find an estimator for a and b, 2) choose$d,\alpha$such that you are happy if$P(|$sample average - true mean$|<d)=1-\alpha$, 3) use the CDF to evaluate (analytically, numerically, whatever floats your boat) which n you require for the probability in step 2 to hold. Remember that the true mean is a number and$n\times$the sample average is irwin-hall$(n)\$ distributed. – Sebastiaan Mar 20 at 14:38
• No offense taken! Thanks for the info and the nudge! – fearless_fool Mar 20 at 15:27