1
$\begingroup$

I have N 2-dimensional points (X,Y) where X and Y are gaussian distributed and have a strong correlation, i.e., X and Y are not independent. What is the simplest way to perform a z-test? In other words, what mean and standard deviation (s.d.) do I use to perform the calculation $$z = \frac{x-\mu}{\sigma}$$?

$\endgroup$
1
  • $\begingroup$ Welcome to Cross Validated! What do you want to test? $\endgroup$ Commented Feb 28, 2024 at 13:18

1 Answer 1

4
$\begingroup$

Suppose you have data $\mathbf{x}_1, \cdots, \mathbf{x}_n$, such that $\mathbf{x}_i$ is a draw from a 2D gaussian with known covariance matrix $\Sigma$ and unknown mean vector $\mu$. Suppose further than you are interested in performing a significance test in which the null hypothesis is that $\mu=\mu_0$, and the alternative is $\mu \neq \mu_0$.

The Wald test Statsitic in this case would be

$$ X = (\bar{\mathbf{x}} - \mu_0)^T \, (\Sigma/n)^{-1} \, (\bar{\mathbf{x}} - \mu_0)$$

The test statistic $X$ should have chi-square distribution with 2 degrees of freedom.

Note the similarity to the z statistic you've posted. Were we to square the test statistic in your question, we would get something like

$$ (\bar{x} - \mu) (\sigma^{2}/n)^{-1}(\bar{x} - \mu) $$

and this test statistic would have chi square distribution with one degree of freedom.

We can test this out using R. I'll simulate data from the null and compute the test statistic 1000 times. We can plot the distribution of drawn test statistics against a chisquare distribution with 2 degrees of freedom.

replicate(1000, { Bigma <- 2.4 * matrix(c(1, 0.8, 0.8, 1), nrow = 2) X <- MASS::mvrnorm(n=100, mu = c(0, 0), Sigma = Bigma) xbar <- apply(X, 2, mean) test_statistic <- t(xbar-c(0, 0)) %*% (solve(Bigma/100)) %*% (xbar-c(0, 0)) test_statistic }) -> chi2 hist(chi2, probability = T, ylim = c(0, 0.6)) curve(dchisq(x, df=2), add=T, from = 0.1, n = 10000) 

Created on 2024-02-28 with reprex v2.0.2

The histogram lines up with the density quite well, giving us confidence in the result in the absence of a theoretical derivation.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.