Skip to content

Instantly share code, notes, and snippets.

# richarddmorey/post2.Rmd Created Mar 9, 2015

 The significance test is perhaps the most used statistical procedure in the world, though has never been without its detractors. This is the second of two posts exploring Neyman's frequentist arguments against the significance test; if you have not read Part 1, you should do so before continuing (["The frequentist case against the significance test, part 1"](http://bayesfactor.blogspot.co.uk/2015/03/the-frequentist-argument-against.html)). Neyman had two major arguments against the significance test: 1. **The significance test fails as an epistemic procedure.** There is no relationship between the \$p\$ value and rational belief. More broadly, the goal of statistical inference is tests with good error properties, not beliefs. 2. **The significance test fails as a test.** The lack of an alternative means that a significance test can yield arbitrary results. The first, philosophical, argument I outlined in [Part 1](http://bayesfactor.blogspot.co.uk/2015/03/the-frequentist-argument-against.html). Part 1 was based largely on [Neyman's 1957 paper "'Inductive Behavior' as a Basic Concept of Philosophy of Science"](http://www.jstor.org/discover/10.2307/1401671?sid=21105582019661&uid=2&uid=4&uid=3738032). Part 2 will be based on Chapter 1, part 3 of [Neyman's 1952 book, "Lectures and conferences on mathematical statistics and probability"](http://drsmorey.org/bibtex/upload/Neyman-1952.pdf). First, it must be said that Neyman did not think that significance tests were useless or misleading, all the time. He said "The [significance test procedure] has been applied since the invention of the first systematically applied test, the Pearson chi-square of 1900, and has worked, on the whole, satisfactorily. However, now that we have become sophisticated we desire to have a theory of tests." Obviously, he is not making a blanket statement that significance tests are, generally, good science; he was making an empirical statement about the applications of significance tests in the first half of the twentieth. It is debatable whether he would say the same about the significance test since then. Of course, we should not evaluate a procedure by its purported results; we can be misled by results, and even worse, this involves an inherent circularity (how do we determine whether the procedure *actually* performed satisfactorily? Another test?). However, this was merely an informal judgment of Neyman's; we should not over-interpret it either way. After all: he will show that the foundation of the significance test is flawed, and he clearly thought this was important. ### An example: Cushney and Peebles' soporific drugs Suppose that we are interested in the effect of sleep-inducing drugs. Cushney and Peebles (1905) reported the effects of two sleep-inducing drugs on 10 patients in a paired design. Conveniently, R has the data for these 10 patients built-in, as the [sleep data set](https://stat.ethz.ch/R-manual/R-patched/library/datasets/html/sleep.html); the data comprise 10 participants' improvements over baseline hours of sleep, for each drug. If we wished to compare the two drugs, we might compute a difference score for each participant and subject these difference scores to a one-sample \$t\$ test. The null hypothesis, in this case, is that the population mean of the difference scores, \$\mu=0\$. Making the typical assumptions of normality and independence, we know that, under the null hypothesis, \[ t = \frac{\bar{x}}{\sqrt{s^2/N}} \sim t_{N-1} \] where \$\bar{x}\$ and \$s^2\$ are the difference-score sample mean and variance. The figure below shows the distribution of the \$t\$ statistic assuming that the null hypothesis is true, with the corresponding \$p\$ values on the top axis. Increasingly red areas show increasing evidence against the null hypothesis, according to the Fisherian view. ```{r echo=FALSE,fig.width=7,fig.height=5} N = 10 xmax = 6 zz = seq(-xmax,xmax,len = 100) par(las=1,cex=1.2, cex.lab=1.3, cex.axis=1.3, mgp=c(2,.7,0),mfrow=c(1,1), lwd=2) plot(zz, dt(zz,N-1), ty='l',ylab="Density",yaxt='n',xlab="t statistic (assuming null is true)",xlim=.93*c(-xmax,xmax)) col.grad = function(p){ rgb(1,1-p,1-p) } nlines = 200 for(i in 0:nlines){ p = i/nlines x0 = p*xmax segments(x0,0,x0,dt(x0,N-1),col=col.grad(p)) segments(-x0,0,-x0,dt(x0,N-1),col=col.grad(p)) } lines(zz, dt(zz,N-1), col="black",lwd=2) p=c(1,.25,.05,.01,.001) axis(3,at=qt(p/2,N-1),lab=p,cex.axis=.8) axis(3,at=qt(1-p[-1]/2,N-1),lab=p[-1],cex.axis=.8) mtext("p value", 3, 2, adj=.5,cex=1.2) ``` If we decided to use the \$t\$ statistic to make a decision in a significance test, we would decide on a criterion: say, \$|t|>2.26\$, which would lead to \$\alpha=0.05\$. Repeating the logic of the significance test, as Neyman put it: > When an "improbable sample" was obtained, the usual way of reasoning was this: "Were the hypothesis \$H\$ true, then the probability of getting a value of [test statistic] \$T\$ as or more improbable than that actually observed would be (e.g.) \$p = 0.00001\$. It follows that if the hypothesis \$H\$ be true, what we actually observed would be a miracle. We don't believe in miracles nowadays and therefore we do not believe in \$H\$ being true." ([Neyman ,1952](http://drsmorey.org/bibtex/upload/Neyman-1952.pdf)) In the case of our sample, we can perform the \$t\$ test in R: ```{r echo=FALSE} t.test(sleep\$extra[1:10],sleep\$extra[11:20], paired = TRUE) ``` In a typical significance test scenario, this would lead to a rejection of the null hypothesis, because \$|t|>2.26\$. ### Neyman's second argument: Significance testing can be arbitrary Remember that at this point, we have not considered anything about what we would expect if the null hypothesis were *not* true. In fact, Fisherian significance testing does not need to consider any alternatives to the null. The pseudo-falsificationist logic of the significance test means that we only need consider the implications for the data under the null hypothesis. Neyman asks: why use the \$t\$ statistic for a significance test? Why use the typical \$\bar{x}\$ and \$s^2\$? Neyman then does something very clever: he defines two new statistics, \$\bar{x}_1\$ and \$s^2_1\$, that have *precisely* the same distribution as \$\bar{x}\$ and \$s^2\$ when the null hypothesis is true, and shows that using these two statistics leads to a *different* test, and *different* results: \[ \begin{eqnarray*} \bar{x}_1 &=& \frac{x_1 - x_2}{\sqrt{2N}},\\ s^2_1 &=& \frac{\sum_{i=1}^N x_i^2 - N\bar{x}^2_1}{N-1}, \end{eqnarray*} \] where \$x_i\$ is the difference score of the \$i\$th participant (assuming the samples are in arbitrary order). Neyman proves that these statistics have the same joint distribution as \$\bar{x}\$ and \$s^2\$, but we can verify Neyman's proof using R. The top row of the plot below shows the histogram of 100,000 samples of \$\bar{x}\$, \$s^2\$, and the \$t\$ statistic for \$N=10\$ and \$\sigma^2=1\$, assuming the null hypothesis is true; the bottom row shows the same 100,000, but computing \$\bar{x}_1\$, \$s^2_1\$, and \$t_1\$, the \$t\$ statistic computed from \$\bar{x}_1\$ and \$s^2_1\$. The red line shows the theoretical distributions. The distributions match precisely. ```{r echo=FALSE,fig.width=6,fig.height=4.5} N = 10 xmax = 6 zz = seq(-xmax,xmax,len = 100) par(las=1,cex=1.3,cex.axis=1.3,cex.lab=1.3) M = 100000 N = 10 mu = 0 sig = 1 doSim = function(mu = 0, sig = 1, N = 20){ x = rnorm(N, mu, sig) xbar = mean(x) s = sd(x) t = xbar/s * sqrt(N) xbar1 = (x - x)/sqrt(2*N) s1 = sqrt(sum(x^2) - N*xbar1^2) / sqrt(N-1) t1 = xbar1 / s1 * sqrt(N) return(c(xbar = xbar, xbar1 = xbar1, s = s, s1 = s1, t = t, t1 = t1)) } z = replicate(M, doSim(mu = mu, sig = sig, N = N) ) par(mfcol=c(2,3)) hist(z["xbar",],freq=FALSE,xlim=c(-2,2),xlab=expression(bar(x)),main="",breaks=20,yaxt="n") zz = seq(-2,2,len=100) lines(zz, dnorm(zz,0,sig/sqrt(N)), col="red") hist(z["xbar1",], freq=FALSE,xlim=c(-2,2),xlab=expression(bar(x)),main="",breaks=20,yaxt="n") lines(zz, dnorm(zz,0,sig/sqrt(N)), col="red") hist(z["s",]^2, freq=FALSE,xlim=c(0,4),xlab=expression(s^2),main="",breaks=20,yaxt="n") zz = seq(0,4,len=100) lines(zz, dchisq(zz/sig^2*(N-1), N-1)/sig^2*(N-1), col="red") hist(z["s1",]^2, freq=FALSE,xlim=c(0,4),xlab=expression(s^2),main="",breaks=20,yaxt="n") lines(zz, dchisq(zz/sig^2*(N-1), N-1)/sig^2*(N-1), col="red") hist(z["t",],freq=FALSE,xlim=c(-6,6),main="",xlab=expression(t),breaks=20,yaxt="n") zz = seq(-4,4,len=100) lines(zz, dt(zz,N-1), col="red") hist(z["t1",], freq=FALSE,xlim=c(-6,6),main="",xlab=expression(t),breaks=20,yaxt="n") lines(zz, dt(zz,N-1), col="red") ``` We now have two sets of statistics that have the same distributions, and will thus produce a significance test with precisely the same properties when the null hypothesis is *true*. Which should we choose? Fisher might object that \$\bar{x}_1\$ and \$s^2_1\$ are not [sufficient](http://en.wikipedia.org/wiki/Sufficient_statistic), but this only pushes the problem onto sufficiency: why sufficiency? The figure below shows that this matters for the example at hand. The figure shows 100,000 simulations of \$t\$ and \$t_1\$ plotted against one another; when \$t\$ is large, \$t_1\$ tends to be small; when \$t\$ is small, \$t_1\$ tends to be large. The red dashed lines show the \$\alpha=0.05\$ critical values for each test, and the blue curves show the limits of bounds within which \$(t,t_1)\$ has to be contained. ```{r echo=FALSE,fig.width=6,fig.height=6} par(las=1,cex=1.3,cex.axis=1.3,cex.lab=1.3) plot(z["t",],z["t1",], pch=19, col=rgb(0,0,1,.05), xlab="t",ylab=expression(t), ylim = c(-6,6), xlim=c(-6,6)) zz = seq(.001,7,len=100) lines(zz, N/zz,col="blue") lines(zz, -N/zz,col="blue") lines(-zz, N/zz,col="blue") lines(-zz, -N/zz,col="blue") abline(h=c(-1,1)*qt(.025,N-1),lty=2,col="red") abline(v=c(-1,1)*qt(.025,N-1),lty=2,col="red") x = sleep\$extra[1:10] - sleep\$extra[11:20] t = mean(x)/sd(x) * sqrt(length(x)) xbar1 = (x - x)/sqrt(2*N) s1 = sqrt(sum(x^2) - N*xbar1^2) / sqrt(N-1) t1 = xbar1 / s1 * sqrt(N) points(t,t1,col="black",pch=21,bg="red") ``` The red point shows \$t\$ and \$t_1\$ for the Cushny and Peebles' data set; \$t\$ would lead to a rejection of the null, while \$t_1\$ would not. Examining the definitions of \$\bar{x}_1\$ and \$s^2_1\$, it isn't difficult to see what is happening; when the null is true, these statistics will have identical distributions to \$\bar{x}\$ and \$s^2\$. However, when the null is *false*, they will not. The distribution of \$\bar{x}_1\$ will continue to have a mean of 0 (instead of \$\mu\$), while the distribution of \$s^2_1\$ will become more spread than \$s^2\$. The effect of this is that the power of the test based on \$t_1\$ will *decrease* as the true effect size increases! A consideration of both Type I and Type II errors makes it obvious which test to choose; we should choose the test that yields the higher power (this is, incidentally, closely related to the Bayesian solution to the problem through the [Neyman-Pearson lemma](http://en.wikipedia.org/wiki/Neyman%E2%80%93Pearson_lemma)). The use of \$t_1\$ would lead to a *bad* test, when both Type I error rates and Type II error rates are taken into account. A significance test, which does not consider Type II error rates, has no account of *why* \$t\$ is better than \$t_1\$. ### More problems The previous development is bad for a significance test; it shows that there can be two statistics that lead to different answers, yet have the same properties from the perspective of significance testing. Following this, Neyman proves something even better: we can always find a statistic that will have the same long-run distribution under the null as \$t\$, yet will yield an arbitrarily high test statistic for *our sample*. This means that we cannot simply base our choice of test statistic on what would yield a more or less conservative test statistic for our sample. Neyman defines some constants \$\alpha_i\$ using the obtained samples \$x_i\$: \[ \alpha_i = \frac{x_i}{\sqrt{\sum_{i = 1}^N x_i^2}} \] then for future samples \$y_i\$, \$i=1,\ldots,N\$ defines \[ \begin{eqnarray*} \bar{y}_2 &=& \frac{\sum_{i=1}^N \alpha_iy_i}{\sqrt{N}},\\ s^2_2 &=& \frac{\sum_{i=1}^N y_i^2 - N\bar{y}_2^2}{N-1}, \end{eqnarray*} \] and of course we can compute a \$t\$ statistic \$t_2\$ based on these values. If we use our observed \$x_i\$ values for \$y_i\$, this will yield a \$t_2=\infty\$, because \$s^2_2 = 0\$, exactly! However, if we check the long-run distribution of these statistics under the null hypothesis, we again find that they are exactly the same as \$\bar{x}\$, \$s^2\$, and \$t\$: ```{r echo=FALSE,fig.width=6,fig.height=4.5} N = 10 xmax = 6 zz = seq(-xmax,xmax,len = 100) par(las=1,cex=1.3,cex.axis=1.3,cex.lab=1.3) M = 100000 mu = 0 sig = 1 x = sleep\$extra[1:10] - sleep\$extra[11:20] N = length(x) alpha = x / sqrt(sum(x^2)) xbar2 = sum(alpha*x/sqrt(N)) s2 = sqrt(sum(x^2)/N - xbar2^2) / sqrt(N-1) t2 = xbar2 / s2 * sqrt(N) doSim2 = function(mu = 0, sig = 1, x){ N = length(x) alpha = x / sqrt(sum(x^2)) x = rnorm(N, mu, sig) xbar = mean(x) s = sd(x) t = xbar/s * sqrt(N) xbar2 = sum(alpha*x/sqrt(N)) s2 = sqrt(sum(x^2) - N*xbar2^2) / sqrt(N-1) t2 = xbar2 / s2 * sqrt(N) return(c(xbar = xbar, xbar2 = xbar2, s = s, s2 = s2, t = t, t2 = t2)) } z = replicate(M, doSim2(mu = mu, sig = sig, x = x) ) par(mfcol=c(2,3)) hist(z["xbar",],freq=FALSE,xlim=c(-2,2),xlab=expression(bar(x)),main="",breaks=20,yaxt="n") zz = seq(-2,2,len=100) lines(zz, dnorm(zz,0,sig/sqrt(N)), col="red") hist(z["xbar2",], freq=FALSE,xlim=c(-2,2),xlab=expression(bar(y)),main="",breaks=20,yaxt="n") lines(zz, dnorm(zz,0,sig/sqrt(N)), col="red") hist(z["s",]^2, freq=FALSE,xlim=c(0,4),xlab=expression(s^2),main="",breaks=20,yaxt="n") zz = seq(0,4,len=100) lines(zz, dchisq(zz/sig^2*(N-1), N-1)/sig^2*(N-1), col="red") hist(z["s2",]^2, freq=FALSE,xlim=c(0,4),xlab=expression(s^2),main="",breaks=20,yaxt="n") lines(zz, dchisq(zz/sig^2*(N-1), N-1)/sig^2*(N-1), col="red") hist(z["t",],freq=FALSE,xlim=c(-6,6),main="",xlab=expression(t),breaks=20,yaxt="n") zz = seq(-4,4,len=100) lines(zz, dt(zz,N-1), col="red") hist(z["t2",], freq=FALSE,xlim=c(-6,6),main="",xlab=expression(t),breaks=20,yaxt="n") lines(zz, dt(zz,N-1), col="red") ``` Again, though, if we considered the power of the test based on \$t_2\$, we would find that it is worse than the power based on \$t\$. The significance test offers no reason why \$t\$ is better than \$t_2\$, but a consideration of the frequentist properties of the test will. Neyman has thus shown that we *must* consider an alternative hypothesis in choosing a test statistic, otherwise we can select a test statistic to give us any result we like. ### Conclusion: The importance of power At the risk of belaboring a point that has been made over and over, power is not a mere theoretical concern for a frequentist. Neyman and Pearson offer an account of why some tests are better than others, and also, in some cases, an account of which test is the optimal; however, just because a test is optimal, does not mean it is *good*. We might always manage to avoid Type I errors at the same rate (assuming the null hypothesis is true), but as Neyman points out, this is not enough; one needs to consider power, and how one wants to treat both Type I error and power. A good frequentist test may balance Type I and Type II error rates; a good frequentist test may control the Type I error rate while having a power that is above a certain probability. From a frequentist perspective these are decisions that must be made prior to an experiment; none of them can be addressed within the significance testing framework. To recap both posts, Neyman makes clear why significance testing, as commonly deployed in the scientific literature, does not offer a good theory of inference: it is fails epistemically by allowing arbitrary "rational" beliefs, and it fails on statistical grounds by allowing arbitrary results. From a frequentist perspective, what might a significance test be useful for? Neyman allows that before a critical set of experiments is performed, exploratory research must be undertaken. Generating a test or a confidence procedure requires some assumptions. Neyman does not offer an account of the process of choosing these assumptions, and seems content to leave this up to substantive researchers. Once a formal inference is needed, however, it is clear that from a frequentist perspective the significance test is inadequate.
to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.