I would like to find the variance of a bivariate normal density (BND), centered at the mean M, such that 95% of its mass is within a certain radius, which depends on the position of a point, A.
(Note: In this toy example, the variances are equal and rho is zero so that the BND will appear as concentric circles.)
The radius is defined as the distance between point M (the mean of the BND, which is fixed) and point A. M is fixed, while A is variable.
In other words, given a certain point A, what is the value of sigma such that 95% of the BND is contained within the radius between M and A?
Since the BND can be decomposed at two univariate densities projecting on two planes, I was wondering if I could just divide the radius by two, and set that as the standard deviation on one dimension. Once I get the standard deviation I can calculate the variances (since they are equal.) In other words, I was wondering if this problem could be the two-dimension version of asking what the variance is if 95% of the density is contained within a certain radius of the mean.
Here is a visualization in r, in which I set the standard deviation as half the radius. It doesn't look right, so I was wondering what would be the correct way to calculate the standard deviation and the variance.
library(mixtools)
library(mnormt)
library(mvtnorm)
library(shape)
# point A
A <- c(3.4, -0.032)
# point M (mean of BND)
M <- c(3.4, 1)
# radius (distance between point and mean of BND)
radius <- M[2] - A[2]
# standard deviation
sd <- radius/2
# sigma
s1 <- sd^2
x.points <- seq(-1,5,length.out=100)
y.points <- seq(-1,5,length.out=100)
z <- matrix(0,nrow=100,ncol=100)
mu1 <- c(3.4,1)
sigma1 <- matrix(c(s1^2,0,0,s1^2),nrow=2)
for (i in 1:100) {
for (j in 1:100) {
z[i,j] <- dmvnorm(c(x.points[i],y.points[j]),
mean=mu1,sigma=sigma1)
}
}
par(pty="s")
contour(x.points,y.points,z,xlim=range(2,5), ylim=c(-1,2), nlevels = 5, drawlabels = TRUE)
points(A[1], A[2], pch = 4, col = "red")
plotcircle(mid = c(3.4, 1), r = 0.04, col = "black")
text(3.65, 0, "A", cex = 1.4)
text(4, 1, "M", cex = 1.4)
text(3.75, 0.4, "radius", cex = 1.2)
segments(3.4, 1, 3.4, 0, col= 'black', cex =1)
Created on 2021-03-16 by the reprex package (v0.3.0)