## ApplyZ2sd

Density of Z under H_0 and under H_1: n=20

Density of Z under H_0 and under H_1: n=20

Density of Z under H_0 and under H_1: n=200

Density of Z under H_0 and under local H_1: n=200

Density of Z under H_0 and under local H_1: n=200

Fig. 4.2. Local, and non-local alternatives

Fig. 4.2. Local, and non-local alternatives null Alternative 1.0179658 0.5957992

> apply(Z,2,function(x) mean(abs(x) >= 1.96))

null Alternative 0.0495 0.8681

> plot(c(-3.5,4.5),c(0,0.7),type="n",xlab="Z",ylab="Density")

> title("Density of Z under H_0 and under H_1: n=20")

null Alternative -0.01035956 8.46298170

null Alternative 1.0067297 0.5825284

> apply(Z,2,function(x) mean(abs(x) >= 1.96))

null Alternative 0.0523 1.0000

> plot(c(-3.5,10),c(0,0.7),type="n",xlab="Z",ylab="Density")

> title("Density of Z under H_0 and under H_1: n=200")

However, if the genetic effect for the larger trial is smaller, then the statistical differences are much more subtle, and the normal shift structure clearly emerges:

> model.local <- list(mu=0,alpha=a0/sqrt(200),

+ delta=d0/sqrt(200),sigma=1,allele ="A")

null Alternative

-0.01035956 3.25015769

null Alternative 1.0067297 0.9332931

> apply(Z,2,function(x) mean(abs(x) >= 1.96))

null Alternative 0.0523 0.9122

> plot(c(-3.5,7),c(0,0.5),type="n",xlab="Z",ylab="Density")

> title("Density of Z under H_0 and under local H_1: n=200")

Observe that one can apply the function "plot" in order to create an empty plot. Setting the argument "type="n"" ensures that the two points that serve to determine the range of the axis are not plotted. Lines, legends, and titles may later be added with the aid of low-level functions.

Remark 4-1- An important theoretical use of local alternatives is to help us interpret the noncentrality parameters of different statistics in terms of sample sizes. Suppose two statistics T1,T2 are both approximately standard normal under the null hypothesis and for a local alternative are approximately normal with variance one and means £i ,£2, respectively. The statistic with the larger value of ^ has greater power, but can we give a quantitative statement about how much better that statistic is? The noncentrality parameters for samples of size n will often be proportional to n1/2, so ^ = n12^i, where are noncentrality parameters for samples of size one. Suppose, to be specific, that M1 > > 0. Now we change the point of view and ask how much larger a sample size we would need if we want to use T2 and yet have the same noncen-trality parameter as T\ has for a given sample size. To address this question, suppose now that the test statistics T\ and T2 are actually based on two different sample sizes, ni and n2, so ^ = n12 ji. The two noncentrality parameters would be the same if n^2j1 = n22 j2, or equivalently n2 = n1(j1/j2)2. Hence to compensate for the smaller value j2, we would have to have a sample size that is larger by the square of the ratio of j1 to j2. If j1 = 1.4 j2, n2 would have to be approximately twice as large as n1 in order that T2 would have the same noncentrality parameter as T1. This is sometimes expressed by saying that T2 is only 50% as efficient as Ti.

0 0