# Confidence interval for distance from center

We have a bivariate normal process where $X \sim N(\mu_x, \sigma), \, Y \sim N(\mu_y, \sigma)$, with no covariance.

$(\mu_x, \mu_y)$ are unknown.

(For convenience we can assert that $\sigma = 1$, or that we have a good estimate for its value.)

We are trying to characterize the distance between our sample center and the true center $(\mu_x, \mu_y)$ as a function of shots sampled n.

Because we don't care about the location of the true center, only our distance from it, we assert that $\mu_x = \mu_y = 0$ and look at the random variable $R(n) = \sqrt{\overline{x_i}^2 + \overline{y_i}^2}$ -- the distance between sample center and true center.

Question: How can we characterize the confidence interval of R(n)?

Note that $R(n) \ge 0$ and $E[R(n)] \to 0$ as $n \to \infty$

I have Monte Carlo estimates of both the mean and standard deviation of R(n) for small n.

I want to calculate confidence levels and intervals for R(n). I.e., given n and confidence level 90% what is the confidence interval of a sample R(n) about its population mean?

I don't believe this is amenable to CLT analysis because the values are bounded at 0.

I suppose I could Monte Carlo the edf since I'm only interested in $n \in [2, 30]$, and the edf must scale with $\sigma$ or $\sigma^2$. But first I want to make sure I'm not missing something obvious or a known closed-form expression.

• Confidence intervals, by definition, apply to parameters. "R(n)" (whatever it might mean) does not appear to be a parameter. Are you perhaps asking for confidence intervals for $\sigma$ (which appears to be the only parameter in the question)? Please edit your question to clarify this point.
– whuber
Feb 27, 2014 at 18:33
• We're looking at gunshot impacts on a target, assuming they're distributed as an independent bivariate normal. We want to "sight in" a gun by taking shots to estimate where the center of impact is. It's common to take only 3 "sighting shots" and use the center of those three points as the estimate of the true center. We want to characterize how far that is on average from the true center, and how that distance shrinks as we take more sighting shots. So, we have n shots with an x and y value, and we compute a sample center C from those. R(n) is the distance of C from the origin. Feb 27, 2014 at 19:53
• Just as a wrap up for statisticians: It the following correct? You want to find a confidence interval for the parameter $\theta := \sqrt{\mu_x^2+\mu_y^2}$, where $(\mu_x, \mu_y)$ is the (unknown) center of spherical normal with known $\sigma$? Feb 28, 2014 at 12:31
• Asserting $E[R(n)]$ goes to zero with large $n$ means, for certain, that the gun sights are absolutely dead-on accurate. I do not see how you can possibly know that; in fact, it seems to me that is the principal question you are addressing when you conduct this kind of study. Declaring $(\mu_X,\mu_Y)$ to be the origin doesn't work, because you do not know these coordinates! You have to use an origin you do know, such as the target center. The two big questions are (1) accuracy: what is $\sqrt{\mu_X^2+\mu_Y^2}$ and (2) precision: what is $\sigma$? These are what you need CIs for.
– whuber
Feb 28, 2014 at 20:54
• Possible duplicate of Distribution of distance from center of sample group Dec 5, 2015 at 15:08

Look at $\chi$ distribution, it's a square root of $\chi^2$ distribution, which is in turn a sum of squared normals.

CORRECTION: $R(n)^2=\sum_{i=1}^n x_i+\sum_{i=1}^n y_i = \sum_{i=1}^{2n}z_i$, where $z_i=x_i$ for $i=(1,n)$ and $z_i=y_{i-n}$ for $i=(1+n,2n)$.

Hence, $R(n) = \sigma r(2n)$, where $r(k)\sim \chi(k)$.

$E[r(2n)]=\mu$, where $\mu=\sqrt{2}\Gamma((2n+1)/2)/\Gamma(n)$ The variance $Var[r(2n)]=(2n-\mu^2)$, see $\chi$ distribution. Subsequently, $E[R(n)]=\sigma E[r(2n)]$ and so on.

UPDATE: the CDF is given by the regularized gamma function: $P(n,r(2n)^2/(2))$. To compute the confidence bounds CB you have to solve for CB in $P(2n,CB^2/2)=\alpha$, where $\alpha$ is the confidence, such as 5% or 95%. CB will be in units of $\sigma$. Your math library should have the regularized gamma function, if it doesn't have its inverse then use the solver to find the CBs.

RESTATED problem

I think that it's best to redefine the $R(n)=\frac{1}{n}\sum_{i=1}^n r_i=\frac{1}{n}\sum_{i=1}^n\sqrt{X_i^2+Y_i^2}$. This means that you compute the distance $r_i$ for each pair of $(X_i,Y_i)$ coordinates, then average it acorss $n$ observation to get $R(n)$. Now, it's clear that $r_i^2\sim\chi^2_2$, assuming that X and Y are standardized normals, while $r_i\sim\chi_2$, i.e. chi distribution with 2 degrees of freedom. I gave the links to this distribution, you should be able to work out the math for non-standard normals.

Next, $R(n)$ is the sum of $\chi_2$ distributed numbers, so CLT should be applicable. For n=30 CLT should work great. I would run Monte Carlo then test it with Jarque-Bera or similar tests of normality for smaller n. If it's normal enough, then do the CLT for R(n), while working with closed-forms of $r_i$.

Example: $(\mu_X,\mu_Y)=(0,0)$, $\sigma_X=\sigma_Y=1$, $\sigma_{X,Y}=0$.

$E[R(1)]=E[r_1]=\mu=\sqrt{2}\frac{\Gamma(\frac{2+1}{2})}{\Gamma(1)}=1.2533$

$Var[R(1)]=Var[r_1]=2\cdot 1-\mu^2= 0.4292$

You can test this with the following Matlab/Octave code:

    m=1e6 % number of samples
n=1 % number of X and Y to compute R
mu = 0*ones(2,1); % set ZERO means
Sig = eye(2); % set unit variance
x = mvnrnd(mu,Sig,m*n)'; % generate X,Y pairs
x = permute(reshape(x,2,n,m),[3,2,1]); % X and Y in 3 dim matrix

r = sqrt(sum(x.^2,3));
R = mean(r,2); % R(n)
hist(R) % show the histogram
jbtest(R) % test normality

[mean(R) std(R) var(R)]


Which outputs:

ans =

1.2519    0.6551    0.4291


Now you can run the same for higher n=30, and get the output:

ans =

1.2534    0.1197    0.0143


Applying the CLT approximation you get $Var[R(30)]_{CLT}=Var[R(1)]/30=0.0143$, very good match, and here's the histogram:

• That looks plausible: R(n) is distributed like chi(2n) / sqrt(2n). If so are there closed-form confidence intervals for samples of that random variable? Feb 27, 2014 at 19:24
• look at the link I gave, it has the CDF as regularized gamma function. I hope it's "closed" enough for you to compute the CIs Feb 27, 2014 at 19:30
• OK, I think I get it. I haven't done closed-form CIs except with Normals, but I assume the method is the same: For confidence level K the confidence interval is given by the inverse CDF between (1-K)/2 and K+(1-K)/2? Is the inverse CDF the same as the Inverse Gamma cdf? Any links I can follow to ensure I don't screw it up? Feb 27, 2014 at 19:45
• Just to be clear, isn't it necessary to use k=2n for the chi distribution to reflect the distribution of R(n), and also necessary to multiply the mean by 1/sqrt(k)? Feb 27, 2014 at 20:07
• @feetwet, you might be right, I overlooked the bar over x and y in your formula. Feb 27, 2014 at 20:29

As shown by @AlecosPapadopoulos here, $R(n) \sim Rayleigh(\sigma / \sqrt{n})$.

From this we can use the closed-form confidence intervals for Rayleigh estimates.