Let's say we have a multivariate normal distribution with two components. The two means $\mu_1$ and $\mu_2$ are both equal to 0 and the covariance matrix is a simple 2x2 square matrix with diag(1, 2, 2).
I want to use this distribution to perform a sample size calculation, so I am trying to calculate the quantiles of it. The mvtnorm R-package allows me to do so quite easily. In my example it would be:
alpha <- 0.05
mean_null <- c(0, 0)
mean_alternative <- c(0, 0)
sigma <- diag(1, 2, 2)
crit_lower <- qmvnorm(p=(alpha/2),
mean=mean_null,
sigma=sigma)$quantile
crit_upper <- qmvnorm(p=1 - (alpha/2),
mean=mean_null,
sigma=sigma)$quantile
This works properly (I think). However, as a test of my understanding I wanted to calculate the power of a test under the null hypothesis (which should be euqal to $alpha$). But this doesn't seem to be the case. See the following code:
# probability of both test statistics being < lower crit
# approximately 0.025, makes sense
pmvnorm(lower=rep(-Inf, 2), upper=rep(crit_lower, 2),
mean=mean_alternative,
sigma=sigma)
probability of both test statistics being > upper crit
This however is way smaller than 0.025
pmvnorm(lower=rep(crit_upper, 2), upper=rep(Inf, 2),
mean=mean_alternative,
sigma=sigma)
The sum of both terms should be the power, e.g. 0.05, but it is way smaller. What is it that I am misunderstanding here?
qmvnorms come fromfMultivar? – Stephan Kolassa Jan 10 '24 at 12:22mvtnormpackage. – Denzo Jan 10 '24 at 12:35