MTB > # Solution for Exercise 27 STAT 657 MTB> # (Note: StatXact results follow the Minitab work, and information about MTB> # the control median test result is at the very end.) MTB > # I'll put the data in c1 and c2, and do some exploration. MTB > set c1 DATA> 231 308287 33291 124550 17075 22955 95102 5649 840585 58924 DATA> end MTB > set c2 DATA> 35324 12457 8276 44 278 840 DATA> end MTB > name c1 'implant' c2 'control' c3 'n score' c4 'combined' c5 'group' MTB > dotplot c1 c2; SUBC> same. :.: . . . . . +---------+---------+---------+---------+---------+-------implant . ::. +---------+---------+---------+---------+---------+-------control 0 150000 300000 450000 600000 750000 MTB > desc c1 c2 N MEAN MEDIAN TRMEAN STDEV SEMEAN implant 10 150665 46107 83229 259190 81963 control 6 9537 4558 9537 13613 5557 MIN MAX Q1 Q3 implant 231 840585 14219 170484 control 44 35324 219 18174 MTB > nsco c1 c3 MTB > plot c3 c1 n score - * - - 1.0+ * - - * - * - * 0.0+ - * - * - * - -1.0+ * - - - * +---------+---------+---------+---------+---------+------implant 0 150000 300000 450000 600000 750000 MTB > nsco c2 c3 MTB > plot c3 c2 n score - * - - 0.80+ - * - - - * 0.00+ - * - - - * -0.80+ - - - * +---------+---------+---------+---------+---------+------control 0 7000 14000 21000 28000 35000 MTB > # Both sample appear to come from highly skewed distributions. I can use MTB > # one of my macros to obtain the sample skewnesses. MTB > let k90 = 1 MTB > exec 'skku' Executing from file: skku.MTB * NOTE * 9 values larger than 1.0E+18 in column C94 converted to missing skewness 2.54302 kurtosis -4.33926 MTB > # The values were too large for the sample kurtosis to be computed MTB > # correctly, but the sample skewness is okay. MTB > let k90 = 2 MTB > exec 'skku' Executing from file: skku.MTB skewness 1.76774 kurtosis 3.19743 MTB > # Since the larger skewness occurs with the larger sample, when the MTB > # difference in sample means is considered, there could be appreciable MTB > # cancellation of skewness in the sampling distribution. Still, due MTB > # to the severe nonnormality and the small sample sizes, Welch's test MTB > # may not be reliable. The apparently drastically unequal variances MTB > # combined with the unequal sample sizes makes Student's two-sample MTB > # t test even more unreliable. MTB > # Welch's test: MTB > twos c1 c2; SUBC> alt = 1. TWOSAMPLE T FOR implant VS control N MEAN STDEV SE MEAN implant 10 150665 259190 81963 control 6 9537 13613 5557 95 PCT CI FOR MU implant - MU control: ( -44760, 327017) TTEST MU implant = MU control (VS GT): T= 1.72 P=0.060 DF= 9 MTB > # Student's two-sample t test: MTB > twos c1 c2; SUBC> pool; SUBC> alt = 1. TWOSAMPLE T FOR implant VS control N MEAN STDEV SE MEAN implant 10 150665 259190 81963 control 6 9537 13613 5557 95 PCT CI FOR MU implant - MU control: ( -89273, 371530) TTEST MU implant = MU control (VS GT): T= 1.31 P=0.10 DF= 14 POOLED STDEV = 207973 MTB > # Approximate version of Mann-Whitney test (using c.c.): MTB > mann c1 c2; SUBC> alt = 1. Mann-Whitney Confidence Interval and Test implant N = 10 Median = 46107 control N = 6 Median = 4558 Point estimate for ETA1-ETA2 is 33130 95.5 pct c.i. for ETA1-ETA2 is (187,272963) W = 104.0 Test of ETA1 = ETA2 vs. ETA1 g.t. ETA2 is significant at 0.0224 MTB > # I'll put the sorted/ordered samples into c11 and c12. MTB > sort c1 c11 MTB > sort c2 c12 MTB > name c11 'sorted i' c12 'sorted c' MTB > print c11 c12 ROW sorted i sorted c 1 231 44 2 5649 278 3 17075 840 4 22955 8276 5 33291 12457 6 58924 35324 7 95102 8 124550 9 308287 10 840585 MTB > # Wald-Wolfowtiz runs test: MTB > # From the sorted sample above it can be seen that there are 8 runs. MTB > # I'll put the mean into k1, the standard deviation into k2, the test MTB > # statistic value into k3, and the approximate p-value into k4. MTB > name k1 'mean' k2 'std dev' k3 'teststat' k4 'p-value' MTB > let k1 = 1 + 2*10*6/16 MTB > let k2 = 2*10*6*(2*10*6 - 16)/(16*16*15) MTB > let k2 = sqrt(k2) MTB > let k3 = (8 + 0.5 - k1)/k2 MTB > cdf k3 k4; SUBC> norm 0 1. MTB > print k1-k4 mean 8.50000 std dev 1.80278 teststat 0 p-value 0.500000 MTB > stack c1 c2 c4; SUBC> subs c5. MTB > desc c4 N MEAN MEDIAN TRMEAN STDEV SEMEAN combined 16 97742 20015 51660 212952 53238 MIN MAX Q1 Q3 combined 44 840585 2042 86057 MTB > # Fisher's exact test: MTB > # From the ordered samples above, and the value of the median of the MTB > # combined sample, we can get that the appropriate table for Fisher's MTB > # exact test is as given below. MTB > # lower upper MTB > # implant 3 7 MTB > # control 5 1 MTB > # The sample sizes and cell counts aren't large enough for an approximate MTB > # p-value to be dependable, but just out of curiosity, I'll compute one MTB > # anyway. MTB > let k3 = 16*(32 - 8)*(32 - 8)/(10*6*8*8) MTB > let k3 = -sqrt(k3) MTB > cdf k3 k4; SUBC> norm 0 1. MTB > print k3 k4 teststat -1.54919 p-value 0.0606676 MTB > # The exact p-value is the sum of two hypergeometric dist'n probabilities. MTB > # It's equal to (about) 0.05944. (So the approximate p-value isn't so MTB > # bad despite the small sample sizes and cell counts.) MTB > write 'Implants' c1 c2 Writing data to file: Implants.DAT * NOTE * Column lengths not equal. MTB > write 'implants' c4 c5 Writing data to file: implants.DAT MTB > save 'Implants' Saving worksheet in file: Implants.MTW ______________________________________________________________________________________ -------------------------------------------------------------------------------------- StatXact Results Welch's test and Student's t test: StatXact only gives p-values for two-sided tests. One has to divide them by 2 (in this case) to get p-values for one-sided tests. These p-values are in agreement with the Minitab results given above. Mann-Whitney test: StatXact gives an exact p-value of about 0.021 (look at p-value under "1-Sided"). Asymptotic p-value from StatXact (about 0.020) corresponds to norm approx. w/o c.c. Two-sample Median test: StatXact gives an exact p-value of about 0.059. Asymptotic p-value from Pearson's test (about 0.019) corresponds to norm approx. w/o the use of Yates's continuity correction. Wald-Wolfowitz runs test: StatXact gives an exact p-value of about 0.50. Asymptotic p-value from StatXact (0.50) corresponds to norm approx. w/ c.c. (Note: The p-value applies to a test against the general alternative, or a two-sided test about the means. We can use the p-value for the desired one- sided test about the means, but we can't divide it by two.) Kolmogorov-Smirnov two-sample test: StatXact gives an exact p-value of about 0.033. _________________________________________________________________________________________ ----------------------------------------------------------------------------------------- Control Median Test The statement of the problem specified that the test statistic should be the number of obsvervations from the implant group less than the 3rd smallest value of the control group. Most of you correctly got that the value of the test statistic, v, is 1. But only one of you got the correct p-value. The probability formula given in the class notes is for an odd sample size for the control sample. I warned in class that it needed to be modifed if there is an even number of values in the control sample. The desired p-value is the probability under the null hypothesis of V taking a value less than or equal to 1 (the observed value of V). For v to be 1, one needs that exactly 1 of the first 3 values is from the treatment group and 2 values are from the control group *and* that the next value is from the control group. The probability that exactly 1 of the first 3 values is from the treatment group is a hyper- geometric probability equal to 15/56 (once you simplify it). (Note: One can imagine sequentially and randomly selecting balls from an urn containing 10 white balls (corresponding to the treatment group) and 6 black balls (corresponding to the control group) to obtain the arrangement of treatment and control values in the ordered combined sample.) Given that exactly 1 of the first 3 values is from the treatment group, the conditional probability that the next selection is from the control group is 4/13. It follows that the null probability of the event {V = 1} is 15/182, or about 0.08242. One can get the null probability of the event {V = 0} in a similar manner, or one can just note that for v = be 0, one needs that the first three selections are all controls, which is (6/16)(5/15)(4/14) = 1/28, or about 0.03571. Altogether, the two probabilities obtained above are summed to arrive at the p-value of 43/364, or about 0.118 (or 0.12).