While running some simulations to get a better grasp of the concept of statistical power I stumbled upon an unexpected result. I was trying to simulate the sampling distribution of test statistic $T$ associated with Pearson correlation coefficient $R$, assuming a sample size of $n = 200$ and a population correlation $\rho = .5$. I expected that this distribution would look like a non-central $T$-distribution with noncentrality parameter $ \lambda = \sqrt{\frac{n \rho^2}{1-\rho^2}} = \sqrt{\frac{200*0.5^2}{1-0.5^2}}=8.164966$ (which is the distribution used in G*Power to calculate statistical power under these circumstances; see page 41 of the manual). However, the distribution I got from my simulation did not at all resemble the plot of the noncentral $pdf$. This is the plot:

Distribution of T

The R code I used is:


n <- 200
rho <- 0.5
noncentrality <- sqrt(((rho**2)*n)/(1-(rho**2)))

tdistsim <- c()
for (i in 1:10000) {
  Variable1 <- rnorm(n,0,1)
  Variable2 <- rho*Variable1+rnorm(n,0,1)
  tdistsim[i] <- cor.test(Variable1,Variable2,method="pearson")$statistic

pdft <- dt(seq(0,15,15/10000),df=n-2,ncp=noncentrality)
       c("Noncentral pdf","Simulation"),

So, obviously, my question is: how is this possible? Aren't these distributions supposed to be (nearly/asymptotically) identical? And if so, where's my error?

EDIT. I think I found the error in my simulation. The standard deviation of the residuals was set to 1 instead of $RMSE = \sqrt{1-\rho^2}$. That is, the line

Variable2 <- rho*Variable1+rnorm(n,0,1)

should read

Variable2 <- rho*Variable1+rnorm(n,0,sqrt(1-rho**2))

The plot now looks like this: enter image description here

  • $\begingroup$ Where exactly in the G*Power manual can we find the cited formula? $\endgroup$ – COOLSerdash Sep 23 '19 at 10:01
  • 1
    $\begingroup$ Page 41. Sorry, will add this to the opening post as well. $\endgroup$ – Barlon Mrando Sep 23 '19 at 10:05
  • $\begingroup$ Re the edit: Do you have a question left to ask? $\endgroup$ – whuber Sep 24 '19 at 11:38
  • $\begingroup$ I don't think so - not unless someone spots another error somewhere. Thanks! $\endgroup$ – Barlon Mrando Sep 24 '19 at 14:54
  • $\begingroup$ What this doesn't resolve is the question about the sampling distribution of the $t$ statistic when you have an arbitrary residual standard deviation, as in your first simulation where you set it to 1. $\endgroup$ – COOLSerdash Sep 29 '19 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.