

small (250x250 max)
medium (500x500 max)
Large
Extra Large
large ( > 500x500)
Full Resolution


RANK TRANSFORMS AND TESTS OF INTERACTION FOR REPEATED MEASURES EXPERIMENTS WITH VARIOUS COVARIANCE STRUCTURES By JENNIFER JOANNE BRYAN Bachelor of Science Oklahoma Christian University Edmond, OK 1996 Master of Science Oklahoma State University Stillwater, OK 2000 Submitted to the Faculty of the Graduate College of the Oklahoma State University in partial fulfillment of the requirements for the Degree of DOCTOR OF PHILOSOPHY May, 2009 ii RANK TRANSFORMS AND TESTS OF INTERACTION FOR REPEATED MEASURES EXPERIMENTS WITH VARIOUS COVARIANCE STRUCTURES Dissertation Approved: Dr. Mark Payton Dissertation Adviser Dr. P. Larry Claypool Dr. Melinda McCann Dr. Lisa Mantini Dr. A. Gordon Emslie Dean of the Graduate College iii ACKNOWLEDGEMENTS I would like to express my sincere gratitude to Dr. Mark Payton for his support, encouragement, and advice, without which I would not have been able to complete this dissertation. I would also like to thank the other members of my committee, Dr. P. Larry Claybool, Dr. Melinda McCann, and Dr. Lisa Mantini, for reviewing my work and providing invaluable guidance. Finally, I would like to extend my gratitude to the entire Department of Statistics at Oklahoma State University. I would also like to thank my family and friends for their support. I am especially thankful to my parents, Philip and JaReesa, and my nephews, Blake and Bryce for their encouragement and loving support throughout this process. iv TABLE OF CONTENTS Chapter Page I. INTRODUCTION ......................................................................................................1 II. BACKGROUND AND LITERATURE REVIEW Sphericity .................................................................................................................4 Normality .................................................................................................................7 Nonparametric Methods...........................................................................................8 Rank Transformations ..............................................................................................9 Aligned Rank Transformation ...............................................................................11 III. LINEAR MODEL AND ASYMPTOTIC DISTRIBUTION FOR ALIGNED RANKS Linear Model ..........................................................................................................14 Alignment ..............................................................................................................15 Asymptotic Distribution.........................................................................................20 IV. SIMULATIONS ....................................................................................................38 V. CONCLUSION ......................................................................................................50 REFERENCES ............................................................................................................53 APPENDICES .............................................................................................................56 v LIST OF TABLES Table Page Compound Symmetric Covariance Structure ..........................................................32 Variance Components Covariance Structure ............................................................45 Compound Symmetric Covariance Structure ...........................................................46 Autoregressive Covariance Structure, ρ=0.75 ..........................................................47 Autoregressive Covariance Structure, ρ=0.5 ............................................................48 Autoregressive Covariance Structure, ρ=0.25 ..........................................................49 1 CHAPTER I INTRODUCTION Repeated measures situations occur when, for a group of subjects, a response is measured repeatedly under different circumstances. The repeated measure factor is usually time and is called the within subject factor. If subjects are divided into groups according to another factor, such as treatment, this is called the between subject factor. Each subject is observed at only one level of a between subject factor. When testing for main and interaction effects in a repeated measures design, traditional univariate Ftests are typically not valid under violations of normality or under violations of homogeneous covariance structures. When the data violates normality, two options have emerged, either transform the data into a form that more closely resembles the normal distribution or use a distribution free procedure. One of the first to discuss transformations was Bartlett (1936, 1947) who proposed a square root transformation and a logarithmic transformation. Rank transformations were popularized by Conover and Iman (1981) as an alternative way to analyze the data that combines these two options. When analyzing repeated measures data, since the response variable is measured repeatedly, the covariance structure is typically nonhomogeneous. The covariance structure of a repeated measures design can be simple, as in the variance components design where all variances are equal and all covariances zero, or very complicated, as in the unstructured design where all variances are unequal and all covariances are different. In analyzing repeated measures, rank transformations can be an 2 alternative to the standard tests performed on the raw data. Rank transformations were initially proposed as an alternative when dealing with data that violated normality or homogeneity of variances. An alternative to utilizing the common rank transform is the aligned rank procedure. The aligned rank transform minimizes the effect of violations of assumptions such as normality and homogeneous covariance matrices, but does not suffer some of the same problems of the rank transform, such as introducing interactions when they are not present or removing interactions when they are present. The question arises as to how the covariance structure may affect the aligned rank transform procedure when analyzing repeated measures. Three specific covariance structures will be investigated, variance components (VC), compound symmetry (CS) and firstorder autoregressive (AR(1)). In a variance components covariance structure, all variances are assumed to be equal and all covariances are 0. A 3×3 example of the variance components structure would be: 2 1 2 1 2 1 0 0 0 0 0 0 σ σ σ . In a compound symmetric covariance structure, the variances are again assumed to be equal as are all the covariances. The variances of the compound symmetric covariance structure are composed of the addition of two variance pieces, σ2 and σ1 2. One of these pieces is then used for all the covariances, σ1 2. A 3×3 example of this covariance structure would be: 2 2 2 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 1 1 1 σ σ σ σ σ σ σ σ σ σ σ σ + + + . 3 Finally, a firstorder autoregressive covariance structure has a multiplicative piece for all offdiagonal entries called ρ which is the correlation between adjacent observations on the same subject. If the entry is adjacent to the diagonal, then the covariance is found by multiplying the variance by ρ. If the entry is two spaces away from the diagonal, then the covariance is found by multiplying the variance by ρ2. For an entry that is three spaces away from the diagonal, the covariance is found by multiplying the variance by ρ3. For an entry that is four spaces away from the diagonal, multiply the variance by ρ4, and so on. A 3×3 example of this covariance structure would be: 2 2 2 1 1 1 ρ ρ σ ρ ρ ρ ρ . This paper will investigate the rank transform test and two approaches to the aligned rank transform test in analyzing data from a repeated measures design. Error distributions that are normal and nonnormal will be investigated as will covariance structures with and without homogeneity of variances. The objectives of this paper are 1) to find how the alignment for the aligned rank transform affects the repeated measures model, 2) to find the variance of the aligned observations, 3) to find the asymptotic distribution of the aligned rank transform test in a factorial setting, and 4) compare the standard test, rank transform test, and two approaches to the aligned rank transform test in analyzing a repeated measures design with the use of Monte Carlo simulations. 4 CHAPTER II BACKGROUND AND LITERATURE REVIEW As was stated previously, repeated measures situations occur when, for a group of subjects, a response is measured repeatedly under different circumstances. When testing for main and interaction effects in a repeated measures design, traditional univariate Ftests are typically not valid under violations of normality or under violations of homogeneous covariance structures. Homogeneity of variances is an assumption that the variances of the groups being tested are equal. This can further be exacerbated when group sizes are unequal. Typically, with such violations, Type I error rates can be inflated (Keselman et al., 1996). The data also violate the assumption of independence since there is typically correlation among the repeated measures observations. Sphericity Sphericity, also referred to as the HuynhFeldt condition, is an assumption concerning the structure of the covariance matrix and is often compared to the assumption of homogeneity of variance for ANOVA. Sphericity occurs when the variance of the difference between the estimated means for any pair of groups or treatments is the same as for any other pair. If a covariance matrix satisfies this condition, it is referred to as a Type H matrix. One way to test for sphericity is to see if the covariance matrix is compound symmetric. If the matrix is compound symmetric, all 5 covariances for measurements within the same subject are equal and all variances are equal. While compound symmetry has been shown to be a sufficient condition for using the traditional analysis of variance (ANOVA) on repeated measures data, it is not a necessary condition. Compound symmetry is a more restrictive form of sphericity. For a repeated measures factor with only two levels, the sphericity assumption is always met since there is, in effect, only one covariance. For a repeated measures factor with three or more levels, a test for sphericity must be done. For betweengroup ANOVA, there is an assumption of independence of the groups. However, repeated measures can introduce covariation between these groups, and so a test for sphericity must be conducted. If the variances of the differences between repeated measures levels are not equal, one must determine the significance of the violation of sphericity. One way to test the severity of the departure is to use Mauchley’s test, which tests the hypothesis that the variances of the differences between repeated measures levels are equal (Mauchly, 1940). If Mauchley’s test is significant, we conclude that there are significant differences among the variances of differences between repeated measures levels and sphericity is not met. While Mauchley’s test can be useful for determining the violation of the condition of sphericity, it can have low power for experiments with small samples. The ability to detect departures from the null hypothesis that the covariance matrix satisfies the Huynh Feldt condition is not very good unless the experiments have a large number of replications (Kuehl, 2000). If sphericity is violated, there are two approaches one can take in order to remedy the violation. One approach is to use a test that does not assume sphericity is present, such as the multivariate analysis of variance or MANOVA. However, in general, 6 MANOVA is a less powerful test than repeated measures ANOVA and should probably not be used (Baguley, 2004). Baguley suggests that if the sample sizes are large, greater than the sum of 10 and the number of repeated measures, and if ε is less than 0.7, where ε is the degree to which sphericity has been violated, then MANOVA may be more powerful and could be a preferred test. Further discussion of ε with three common ways to measure it will be discussed next. The other approach is to use a correction to the degrees of freedom for the standard ANOVA tests. Three such corrections are the GeisserGreenhouse Ftest, the GreenhouseGeisser correction (Greenhouse and Geisser, 1959) and the HuynhFeldt correction (Huynh and Feldt, 1976). In the Geisser Greenhouse Ftest, the numerator degrees of freedom are set to 1 and the denominator degrees of freedom are set to n (the total number of subjects). This is a very conservative approach. The other two corrections adjust the degrees of freedom in the standard ANOVA test to produce a more accurate observed significance value. The Greenhouse Geisser correction, usually denoted as εˆ , varies between 1 K −1 and 1, where K is the number of repeated measures. The closer εˆ is to 1, the more homogeneous the variances of the differences and hence the closer the data are to being spherical. Both the numerator and denominator degrees of freedom are multiplied by 2 2 [ ( ' )] ˆ ( 1) [( ' )] tr C SC K tr C SC ε = − , where S is the pooled sample covariance matrix, C is a normalized matrix of K1 orthogonal contrasts. The assumption of sphericity is satisfied if and only if the K1 contrasts are independent and equally variable. (Keselman et al., 2001). When repeated measures designs have a betweensubject grouping variable, the covariance matrices of the 7 treatment differences must be the same or homogeneous for all levels of the grouping factor. This is referred to as multisample sphericity. (Keselman, et al., 2001). Huynh and Feldt (1976) reported that when εˆ > 0.75, the test is too conservative and Collier, et al. (1967) showed that this can be true with εˆ as high as 0.90. Huynh and Feldt (1976) proposed a correction to εˆ , denoted ε%, to make it less conservative. As in the GreenhouseGeisser correction, both the numerator and denominator degrees of freedom are multiplied by ( 1)( 1) ˆ 2 ( 1)[ ( 1) ˆ] N J K K N J K ε ε ε − + − − = − − − − % , where N is the total number of subjects, J is the number of treatments or betweensubject factors, and K is the number of levels of the repeated measures or withinsubject factors (Keselman, et al., 2001). However, Maxwell and Delaney (1990) report that ε%actually overestimates sphericity. Stevens (1992) recommends taking an average of both the HuynhFeldt and Greenhouse Geisser measures and adjusting the degrees of freedom by this averaged value. Girden (1992) recommends that when εˆ > 0.75, the degrees of freedom should be corrected using ε%. If εˆ < 0.75 or if nothing is known about sphericity at all, then the conservative εˆ should be used to adjust the degrees of freedom. Normality Normality is an assumption that the data come from a normal distribution. If the normality assumption is violated, one solution is to transform the data prior to the analysis. Common transformations include logarithms or the square root function. Another solution is to use a procedure that is distribution free. This solution often involves methods that are based on the ranks of the data. If the assumption of normality is violated, one of the most frequently recommended alternatives is the nonparametric 8 Friedman rank test (Harwell and Serlin, 1994). The rank transformation procedure, proposed by Conover and Iman (1981), combines these by replacing the data with ranks and then applying parametric tests to the ranks, and is discussed in more detail in this chapter. Nonparametric tests Nonparametric tests are based on some of the same assumptions on which parametric tests are based, but they do not assume a particular population probability distribution and thus are valid for data from any population. Wilcox (1998) notes that even arbitrarily small departures from normality can result in lower power for the parametric methods versus the nonparametric methods. Many nonparametric tests apply some kind of rank transformation to the data, such as replacing the data with their ranks, and then use the usual parametric procedure on the ranks instead of the data. The Wilcoxon Signed Rank test is used to test whether a particular sample came from a population with a specified mean or median. Differences between bivariate data (or in one sample, the individual observations) are ranked from 1 to n and the resulting test statistic has an approximate standard normal distribution. The MannWhitney test, which is also called the Wilcoxon Rank Sum test, takes two independent samples from two populations and tests if the populations have equal means. Observations are ranked from 1 to N, the sum of the two sample sizes. The test statistic is then conducted using the ranks. If there are no ties and N ≤ 50 , lower quantiles of the exact distribution of the test statistic can be found in tables (Conover, 353). If there are a large number of ties in the ranks, the test statistic is an approximately standard normal distribution. The Kruskal 9 Wallis test extends the MannWhitney test, to k independent samples from k populations. While the exact distribution of the KruskalWallis can be found, it is often difficult to work with and therefore an approximate chisquared distribution with k1 degrees of freedom is used when conducting hypothesis tests. The Friedman rank test uses observations from b mutually independent kvariate random variables from a randomized complete block design, where b is the number of blocks. Ranks are assigned to observations separately within each block with ranks ranging from 1 to k. The exact distribution of the test statistic is difficult to find and so an approximate chisquared distribution with k1 degrees of freedom is used. However, this approximation may sometimes be poor and thus a second test statistic is used that has an approximate Fdistribution with k1 and (b1)(k1) degrees of freedom. The Quade test extends Friedman’s test by taking the range for the observations in each block and then ranking the ranges. The block rank is then multiplied by the difference between the rank of the observation in each block and the average rank within blocks. The distribution of the resulting test statistic is again difficult to find, but it can be approximated by an Fdistribution with k1 and (b1)(k1) degrees of freedom, just like the Friedman test. Rank Transformations Rank transformation procedures were proposed as an alternative when dealing with violations of normality and sphericity. One such transformation was to rank all the observations without regard to group or measure and use these ranked scores instead of the original data when using the typical analysis of variance (Conover and Iman, 1981). Two reasons for the popularity of the rank transformation statistic are that it is relatively 10 simple and it is accessible in most statistical packages since the traditional Fstatistic is calculated based on the rank transformation of the original observations. For single sample repeated measures designs, the ANOVA Ftest was robust to violations of normality when performed on ranks (Zimmerman and Zumbo, 1993) and to violations of sphericity (Agresti and Pendergast, 1986). However, the rank transformation procedure may have problems in factorial experiments. While theoretical results suggest that the rank transformation procedure provides asymptotically valid tests for analyzing experiments when additive effects are present (Iman, et al., 1984), a problem may occur if interactions are present. The rank transformation procedure may introduce interactions that were not present in the original data or it may remove interactions that were present in the original data (Higgins and Tashtoush, 1994). Akritas (1990) showed that the rank transform procedure is not valid for most of the common hypotheses in twoway crossclassifications and nested classifications primarily because of the nonlinear nature of the rank transform. Akritas (1991) also showed that the rank transform procedure can destroy the equicorrelation between error terms and/or the assumption of equal covariance matrices, which renders the rank transform procedure invalid for most situations. Akritas (1991) notes that the rank transform procedure for repeated measure designs with general covariance matrices could be used in some cases where the equicorrelation assumption is destroyed. Higgins and Tashtoush (1994) suggest that there is no justification for generally applying the rank transform procedure in factorial experiments with interaction, but there may be special cases where it is appropriate. 11 Also, there have been conflicting simulation studies concerning the performance of the rank transform for interactions in a twoway layout. Iman (1974) and Conover and Iman (1976) showed that the rank transform statistic performed well in detecting interactions when there were small sample sizes and small main effects. Iman (1974) studied a factorial design and Conover and Iman (1976) studied a 4×3 factorial design with 5 replications. In both studies, it was concluded that the rank transform statistic was powerful and robust. However, simulations by Blair, et al. (1987) showed that the Type I error rates in the tests for interaction effects were unacceptably large if either the main effects or the sample sizes are large. They also showed that the interaction and main effect relationships were not expected to be maintained after the rank transformation was applied. Thompson (1991) suggested the need to study the asymptotic properties of the rank transform procedure for interactions. Thompson showed that, for a balanced twoway classification, the limiting distribution of the rank transform statistic multiplied by its degrees of freedom was a χ2distribution if and only if either there is only one main effect or if there are exactly two levels of both main effects. If this is not the case, there exist values for the main effects where the expected value of the test statistic under the null hypothesis approaches infinity as the sample size increases. Thus, the rank transform procedure becomes liberal with type I error rates even for large sample sizes. Aligned Rank Transformation Aligned rank transformation procedures were popularized by Higgins and Tashtoush (1994) as a way to ‘correct’ the rank transform. They suggest aligning the data first by removing the effect of any ‘nuisance’ parameters and then ranking the aligned 12 data. To align the data for a repeated measures design, one would subtract two parameters, the repeated measures main effect and the subject effect and then add in the overall mean. Mathematically, for a repeated measures design, the aligned data would be, ijk ijk ij. ..k ... AB = Y −Y −Y +Y (1) where ij. Y is the mean for the jth subject, given the ith treatment, and averaged across the repeated measures, ..k Y is the marginal mean for the kth repeated measure over all subjects and treatments, and ... Y is the grand mean. Higgins and Tashtoush also note that another alignment could be used for repeated measures and call this the naïve alignment. This alignment is the same as the alignment for the twoway completely random design. Data used under this alignment would be, .. . . .. ... 2* ijk ijk i j k AB = Y −Y −Y −Y + Y (2) where i.. Y is the marginal mean for the ith treatment over all subjects and repeated measures, . j. Y is the marginal mean for the jth subject over all treatments and repeated measures, ..k Y is the marginal mean for the kth repeated measure over all subjects and treatments, and ... Y is the grand mean. After either alignment, the transformed data are then ranked as in the rank transform procedure. Hettmansperger (1984) also suggests that this alignment could be accomplished by obtaining residuals from a linear model by regressing the original data on a set of dummy codes that represent the subject effect and a set of contrast codes that represent the repeated measures main effect. Since the aligned rank transform test is based on the Fdistribution, it is not distribution free. Higgins and Tashtoush (1994) concluded that it appeared to be a robust procedure with respect to the error distribution and critical values can be adequately 13 approximated by those of the Fdistribution. They also say that the test “has many of the desirable power properties of the common nonparametric tests. Moreover, the tests do not have the same potential for giving misleading results as the ordinary rank transform tests when applied to multifactor experiments with interaction.” Beasley (2000) notes that test statistics for the rank transform procedure maintain the expected Type I error rate when a slight repeated measure main effect was present. However, by not removing the repeated measure main effect through alignment, tests for interaction may demonstrate lower power when a strong repeated measures main effect is present. However, many properties of the original data transmit to ranks including heterogeneity of variance (Zimmerman and Zumbo, 1993) and nonsphericity (Harwell and Serlin, 1994). Thus, corrections to the degrees of freedom can be performed if the covariance matrix is nonspherical or heterogeneous. Mansouri and Chang (1995) showed that for most light or heavytailed distributions, such as the uniform, exponential, double exponential and lognormal, the aligned rank transform was a more robust test statistic than the rank transform and was a powerful test. They also showed that the classical Ftest had a severe loss of power for asymmetric or heavytailed distributions. However, for a Cauchy distribution, the rank transform performed considerably better than the aligned rank transform since the Type I error rate was less inflated. Similarly, Higgins and Tashtoush (1994) showed that for lighttailed, symmetric distributions, the classical Ftest had a slight power advantage over the aligned rank transform with results generally less than 0.10. However, for heavytailed distributions or skewed distributions, the aligned rank transform was superior and that the power advantages could be substantial, with results often in the 0.15 to 0.30 range. 14 CHAPTER III LINEAR MODEL AND ASYMPTOTIC DISTRIBUTION FOR ALIGNED RANKS To perform the alignment on our repeated measures design for the aligned rank transform, the linear model must be defined. The linear model for a repeated measures design is the following: ( Yijk = μ +αi + d j i) +βk + (αβ )ik + eijk (3) where: i = treatment levels (1 to t) j = subjects (1 to s) k = repeated measures (1 to r) μ = overall mean i α = treatment i effect (whole plot effect) j (i) d = random effect of subject j in treatment i (whole plot error) k β = repeated measure k effect (subplot effect) ik αβ = treatment i by repeated measure k interaction ijk e = random error (subplot error) Transforming this into matrix notation, we have: Y = Xβ + Zu + e (4) where: X = tsr * (1 + t + r + tr) design matrix consisting of 0’s and 1’s β = (1 + t + r + tr) * 1 matrix of fixed effects consisting of μ , i α , k β , ik αβ Z = tsr * st design matrix consisting of 0’s and 1’s u = st * 1 matrix of random effects, u ~ MVN(0, G) consisting of j (i) d e = tsr * 1 matrix of random errors, e ~ MVN(0, R) consisting of ijk e R = block diagonal matrix with diagonal elements Σ Σ = covariance matrix for the repeated measures effects 15 Alignment Using the above matrix definition of Y in equation (4) we know that E(Y) = X β and Var(Y) = ZGZ' + R. In a repeated measures design, both design matrices, X and Z, can be written as partitioned matrices that can be defined using Kroenecker products. In this case, X = [    ] t s r t s r t s r t s r 1 ⊗1 ⊗1 I ⊗1 ⊗1 1 ⊗1 ⊗I I ⊗1 ⊗I and Z = [ ] t s r I ⊗I ⊗1 . We can also define each piece of the alignment in equation (1) using matrices: ijk = i ⊗ j ⊗ k * Y I I I Y , 1 * k = ⊗ ⊗ ij. i j k Y I I J Y , 1 1 * i j = ⊗ ⊗ ..k i j k Y J J I Y , and 1 1 1 * i j k = ⊗ ⊗ ... i j k Y J J J Y . Assuming i = 1, … ,t, j = 1, … , s and k = 1, … , r, we see the following for the alignment from equation (1): ijk ij. ..k ... Y −Y −Y +Y [ ] 1 1 1 1 1 1 * * * r t s t s r = ⊗ ⊗ − ⊗ ⊗ − ⊗ ⊗ + ⊗ ⊗ t s r t s r t s r t s r I I I *Y I I J Y J J I Y J J J Y 1 1 1 1 (  ) * (  ) * r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J Y J J I J Y (5) Substituting in our matrix definition of Y from equation (4), we can write the following: Alignment(Y) 1 1 1 1 (  ) *( ) (  ) *( ) r t s r = ⊗ ⊗ + + − ⊗ ⊗ + + t s r r t s r r I I I J Xβ Zu e J J I J Xβ Zu e 16 Theorem 1: For a repeated measures design, Y = Xβ + Zu + e , with t levels of treatment, s subjects per treatment, and r repeated measurements per subject, the alignment for Y is, Alignment(Y) = X* * β + 0 + e* = X* * β + e* where tsr x (1+t+r+tr ) X* 1 1    (  ) (  ) t r = ⊗ ⊗ tsr x 1 tsr x t tsr x r t t s r r 0 0 0 I J 1 I J and * tsr x 1 e 1 1 1 1 (  ) * (  ) * r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J e J J I J e Proof: Looking at each piece of Y separately, we find: Alignment(Xβ) 1 1 1 1 (  ) *( ) (  ) *( ) r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J Xβ J J I J Xβ [ ] 1 (  ) *    * r = ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r r t s r t s r t s r t s r I I I J 1 1 1 I 1 1 1 1 I I 1 I β [ ] 1 1 1 (  ) *    * t s r − ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r r t s r t s r t s r t s r J J I J 1 1 1 I 1 1 1 1 I I 1 I β 1 1   (  )  (  ) * r r = ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r t s r t s r r t s r r 1 1 0 I 1 0 1 1 I J I 1 I J β 1 1 1 1   (  )  (  ) * t r t r − ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r t s r t s r r t s r r 1 1 0 J 1 0 1 1 I J J 1 I J β 1 1    (  ) (  ) * t r = ⊗ ⊗ tsr x 1 tsr x t tsr x r t t s r r 0 0 0 I J 1 I J β = X* * β (6) Alignment(Zu) 1 1 1 1 (  ) *( ) (  ) *( ) r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J Zu J J I J Zu 17 [ ] [ ] 1 1 1 1 (  ) * * (  ) * * r t s r = ⊗ ⊗ ⊗ ⊗ − ⊗ ⊗ ⊗ ⊗ t s r r t s r t s r r t s r I I I J I I 1 u J J I J I I 1 u [ ] 1 1 * * t s = ⊗ ⊗ − ⊗ ⊗ t s r t s r I I 0 u J J 0 u= [ ]* = tsr x ts tsr x 1 0 u 0 (7) Alignment(e) 1 1 1 1 (  ) * (  ) * r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J e J J I J e = e* (8) Thus, Alignment(Y) = X* * β + 0 + e* = X* * β + e* . This completes the proof. Previously, we defined Var(Y) as ZGZ’ + R. This can also be defined using matrices as, Var(Y) = t ⊗ s ⊗(σ 2 r + ) I I J Σ , where σ2 is the variance of the dj(i) terms and Σ appears as a block diagonal element of R. Remember that Σ is the covariance matrix for the repeated measures effects. Calculating the variance of Y after alignment, we see that: Theorem 2: For a repeated measures design, Y = Xβ + Zu + e , with t levels of treatment, s subjects per treatment, and r repeated measurements per subject, the variance of the alignment of Y is, Var(Alignment(Y)) 1 1 1 1 1 1 (  )* *(  ) (  )* *(  ) r r t s r r = ⊗ ⊗ − ⊗ ⊗ t s r r r r t s r r r r I I I J Σ I J J J I J Σ I J . (9) Proof: Recall that when performing a linear transformation on a random vector Y, such as multiplying the vector by a matrix like we did for the alignment, the variance is then premultiplied by that same matrix and post multiplied by the transpose of that matrix. 18 For our alignment, since our alignment matrix is symmetric, we will pre and post multiply the variance matrix, t ⊗ s ⊗(σ 2 r + ) I I J Σ , by 1 1 1 1 (  ) (  ) r t s r ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J J J I J which was previously defined in equation (5). So, Var(Alignment(Y)) 2 1 1 (  ) * ( ) * (  ) r r = ⊗ ⊗ ⊗ ⊗ σ + ⊗ ⊗ t s r r t s r t s r r I I I J I I J Σ I I I J 1 1 1 2 1 1 1 (  ) * ( ) * (  ) t s r t s r − ⊗ ⊗ ⊗ ⊗ σ + ⊗ ⊗ t s r r t s r t s r r J J I J I I J Σ J J I J 2 1 1 (  )*( ) * (  ) r r = ⊗ ⊗ σ + ⊗ ⊗ t s r r r t s r r I I I J J Σ I I I J 1 1 1 2 1 1 1 (  )*( ) * (  ) t s r t s r − ⊗ ⊗ σ + ⊗ ⊗ t s r r r t s r r J J I J J Σ J J I J 1 1 (  )*( ) * (  ) r r = ⊗ ⊗ + ⊗ ⊗ t s r r t s r r I I I J 0 Σ I I I J 1 1 1 1 1 1 (  )*( ) * (  ) t s r t s r − ⊗ ⊗ + ⊗ ⊗ t s r r t s r r J J I J 0 Σ J J I J 1 1 1 1 1 1 (  )* *(  ) (  )* *(  ) r r t s r r = ⊗ ⊗ − ⊗ ⊗ t s r r r r t s r r r r I I I J Σ I J J J I J Σ I J . This completes the proof. This alignment can simplify under specific covariance structures. For example, if the covariance structure is that of variance components, then 2 t σ = Σ Ir . Substituting this into our previous alignment, we find, Var(Alignment(Y)) 2 2 1 1 1 1 1 1 ( )* *( ) ( )* *( ) t t r r t s r r = ⊗ ⊗ σ − ⊗ ⊗ σ t s r r r r r t s r r r r r I I I  J I I  J J J I  J I I  J 19 2 2 1 1 1 1 ( ) ( ) t t r t s r =σ ⊗ ⊗ −σ ⊗ ⊗ t s r r t s r r I I I  J J J I  J 2 1 1 1 1 (  ) (  ) t r t s r σ = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J J J I J . (10) If the covariance is compound symmetric, then 2 ( (1 ) ) t σ = ρ + −ρ Σ Jr Ir and Var(Alignment(Y)) 2 [ ] 1 1 (  )* (1 ) *(  ) t r r = ⊗ ⊗ σ ρ + −ρ t s r r r r r r I I I J J I I J 1 1 1 2 [ ] 1 (  )* (1 ) *(  ) t t s r r − ⊗ ⊗ σ ρ + −ρ t s r r r r r r J J I J J I I J 2 [ ] 1 1 (  )* *(  ) t r r =σ ρ ⊗ ⊗ t s r r r r r I I I J J I J 2 [ ] 1 1 (1 ) (  )* *(  ) t r r +σ −ρ ⊗ ⊗ t s r r r r r I I I J I I J 2 [ ] 1 1 1 1 (  )* *(  ) t t s r r −σ ρ ⊗ ⊗ t s r r r r r J J I J J I J 2 1 1 1 [ ] 1 (1 ) (  )* *(  ) t t s r r −σ −ρ ⊗ ⊗ t s r r r r r J J I J I I J 2 [ ] 2 2 1 1 1 (1 ) (  ) t t t r t s =σ ρ ⊗ ⊗ +σ −ρ ⊗ ⊗ −σ ρ ⊗ ⊗ t s r t s r r t s r I I 0 I I I J J J 0 2 1 1 1 (1 ) (  ) t t s r −σ −ρ ⊗ ⊗ t s r r J J I J 2 2 1 1 1 1 (1 ) (  ) (1 ) (  ) t t r t s r =σ −ρ ⊗ ⊗ −σ −ρ ⊗ ⊗ t s r r t s r r I I I J J J I J 2 1 1 1 1 (1 ) (  ) (  ) t r t s r σ ρ = − ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J J J I J . (11) 20 Unfortunately, it can be difficult to write the covariance as a Kroenecker product for more complicated covariance structures and thus a convenient formula for the alignment cannot be found using Kroenecker products. For such covariance structures, Σ, we simply use the general form of the alignment from equation (9) which was: Var(Alignment(Y)) 1 1 1 1 1 1 (  )* *(  ) (  )* *(  ) r r t s r r = ⊗ ⊗ − ⊗ ⊗ t s r r r r t s r r r r I I I J Σ I J J J I J Σ I J . Now we will look at the asymptotic distribution of the aligned rank transform statistic. First, we will look at the asymptotic properties of the rank transform statistic. Thompson (1991) studied the asymptotic properties of the rank transform statistic for interactions in a balanced twoway classification. In order to attain an appreciation for Thompson’s work, it will be covered with considerable detail in this chapter. Asymptotic Distribution Thompson, in a 1991 article from Biometrika, defines the model for the twoway layout with interaction as ( ) ijn i j ij ijn X = θ + α + β + αβ + ε (12) where: i = main effect 1 levels (1 to I) j = main effect 2 levels (1 to J) n = replication (1 to N) θ = overall mean i α = main effect i j β = main effect j ij αβ = main effect i by main effect j interaction ijn ε = random error 21 Thompson also defines Fij ( x) = F ( x −θ −α i − β j ) as the distribution function of Xijn under the null hypothesis of no interaction effect and 1 ( ) ( ) ij i j H x F x IJ = ΣΣ as the average distribution function. For a fixed value i ' of i and a fixed value j ' of j, define ' ' ' ' ( ) i j i j H X = H . For the rank transform statistic, let Rijn denote the rank of Xijn among all IJN observations and let the Wilcoxon score be aijn = Rijn/(IJN + 1). Thompson defines 2 1 1 . . . . . . . . 1 J I 1 1 1 j i i j i j Q a a a a N = = J I I J = − − + Σ Σ , 2 1 1 1 . 1 N J I 1 n j i ijn ij D a a IJN IJ = = = N = − − Σ Σ Σ , and states that the statistic ( 1) Q T I J I J D = − − + is the classical normal theory test for interaction with the Wilcoxon scored ranks, aijn, substituted in place of the observations. Notice that for T to eventually be a χ2 distribution, the terms being summed in Q must be independent. Thompson set out to determine when the asymptotic distribution of T, under the null hypothesis, would not be 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + . To do this, Thompson stated and proved two lemmas. We will also need to define some terms. Let ( ) ij ij μ = N × E H , 11. . ( ,..., ) IJ a = a a ′ , 11. . ( ,..., ) IJ μ = μ μ ′ and let Γ be an IJ × IJ matrix whose rows and columns are indexed by the ordered pairs (i, j) and (r, s) where i, r = 1, 2, …, I and j, s = 1, 2, …, J. The (i, j) and (r, s)th element of Γ is 22 1 1 1 1 1 1 c o v ( ), ( ) J I J I v u v u i j ij u v r s r s u v H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Also let 2 ( i , j ) γ be the (i, j)th diagonal element of Γ. Since 0 < var(Hij) < ∞, then 0 < ( i , j ),( r ,s ) γ < ∞. Lemma 1 (Thompson): Under the null hypothesis, 1 N 2 ( ) − a − μ converges in distribution to (0, ) IJ N Γ ; in particular, 1 2 . ( , ) ( ) ij ij i j N a μ γ − − converges in distribution to N (0,1) . We are only concerned with the univariate case and Thompson notes that the univariate result for the proof follows by applying Theorem 3.3 (See Appendix A) from Thompson and Ammann (1989) to the linear rank statistic aij. with Wilcoxon scores and then simplifying the expression for the variance. Lemma 2 (Thompson): Under the null hypothesis, D converges in probability to the nonnegative, finite constant { }2 2 1 1 1 ( ) var( ) 3 ij ij E H H IJ IJ σ = − Σ Σ = Σ Σ Thompson notes that the proof is almost identical to the proof of Theorem 5.3 of Thompson and Ammann (1989). See Appendix A for a restatement of this theorem. Thompson then noted that, under the null hypothesis of no interactions, T converges in distribution to 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + by Lemma 1 and Lemma 2. From this statement, it is assumed that Thompson is inferring that the normalbased Analysis of Variance methodology holds with ij. a serving as the response variable and Q serving as a Treatment Sum of Squares. 23 Thompson then stated and proved the following Theorem: Theorem 3 (Thompson): Under the null hypothesis of no interaction as N → ∞ , lim E(T) is finite if and only if (i) E(Hij −Haj )does not depend on j for all 1 ≤ i, a ≤ I and 1 ≤ j ≤ J (ii) ( ) ij ib E H −H does not depend on i for all 1 ≤ i ≤ I and 1 ≤ j,b ≤ J Partial Proof from Thompson: Since Thompson is using an analog to ANOVA for the test statistic T, we know that D and Q are independent. It follows from Lemma 2 and Slutsky’s theorem that lim ( ) N E T →∞ is finite if and only if lim ( ) N E Q →∞ is finite. Define an IJ × IJ matrix A as having elements 1 1 1 (i, r ) ( j , s ) ( j , s ) (i, r ) I J IJ δ δ − δ − δ + where δ(i,r) = 1 if i = r and 0 if i ≠ r. Then Q is the quadratic form 1 a ' Aa N . Because A does not depend on N and because the elements of Γ converge to finite values, tr(AΓ) is finite and lim ( ) N E Q →∞ = tr(AΓ) + 1 lim ' N e Ae →∞ N where 11 ( , ..., ) IJ e = e e and . ( ) ij ij e = E a . Then lim ( ) N E Q →∞ is finite if and only if e'Ae = O ( N ) . Note that 2 . . .. 1 1 1 ( ) ( ) ij i j e e e e O N J I IJ e'Ae = Σ Σ − − + = is equivalent to 1 2 . . .. 1 1 1 ( ) i j i j e e e e O N J I IJ − − + = 24 for all i and j. Theorem 3.3 of Thompson and Ammann (1989) and Lemma 1.5.5.A of Serfling (1980) imply that ( , ) lim 0 N ij ij i j e μ →∞ γ − = where ( ) ij ij μ = N × E H and (i , j ) γ is the square root of the (i, j)th diagonal element of the covariance matrix Γ where the (i, j), (r, s)th element of Γ is 1 1 1 1 1 1 co v ( ), ( ) J I J I v u v u ij ij u v r s r s u v H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Because 0 < ( i , j ) γ < ∞ and ( i , j ) γ does not depend on N, both eij and μij converge to the same limit as N increases. Therefore, . . .. 1 1 1 ij i j e e e e J I IJ − − + is 1 O(N 2 ) if and only if . . .. 1 1 1 ij i j J I IJ μ − μ − μ + μ is 1 O(N 2 ) , which is equivalent to . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = for all i and j where ( ) ij ij ν = E H . We can show this last equivalency using a contrapositive argument. Assume . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = C ≠ . Then . . .. 1 1 1 ( ) ij i j J I IJ μ − μ − μ + μ = CN and thus, 25 . . .. 1 1 1 lim( ) N ij i j J I IJ μ μ μ μ →∞ − − + = ∞ which is not 1 O(N 2 ) . Therefore, . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = . To obtain the results in (i), that is, ( ) ij aj E H − H does not depend on j for all 1 ≤ i,a ≤ I and 1≤ j ≤ J , subtract . . .. 1 1 1 0 aj a j J I IJ ν − ν − ν + ν = from . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = . This gives . . 1 ( ) ij aj i a J ν −ν = ν −ν which does not depend on j. The result for (ii), ( ) ij ib E H − H does not depend on i for all 1 ≤ i ≤ I and 1 ≤ j,b ≤ J , is obtained similarly. This completes Thompson’s proof. Note that Thompson only proved one direction of the theorem, that is that if lim ( ) N E T →∞ is finite then ( ) ij aj E H − H does not depend on j for all1 ≤ i, a ≤ I and 1 ≤ j ≤ J . When lim ( ) N E T →∞ is not finite, then Thompson noted that T was not asymptotically chisquared and becomes very liberal for large samples. Thompson also noted that the rank transform should not be used to detect interactions if (i) and (ii) of Theorem 3 can not be shown to hold. Thompson noted that Theorem 3 holds if there is only one main effect, that is when Fij = Fi or Fij = Fj. Thompson also noted that if both main effects were present, Theorem 3 holds only if there are two levels of each main effect and states the following: Corollary 4 (Thompson): When both main effects are present, conditions (i) and (ii) are satisfied for all values of αi and βj if and only if I = J = 2. 26 Proof (Thompson): Assume that I = J = 2. Conditions (i) and (ii) are equivalent to E (H11 − H 21 ) − E (H12 − H 22 ) = 0 . By expanding H(x) as a sum, changing variables in the integrals, and cancelling terms, this can be shown to be equivalent to ∫{F (x + 2α + 2β ) + F (x − 2α − 2β )} f (x)dx − ∫{F ( x + 2α − 2β ) + F ( x − 2α + 2β )} f ( x )dx = 0 . (13) To show that equation (13) always holds, we note that ∫{F ( x + δ ) + F ( x − δ )} f ( x)dx is a constant function in δ by showing that its partial derivative with respect to δ is ∫{ f ( x + δ ) − f ( x − δ )} f ( x )dx = 0 . Since the score function is nondifferentiable in only a countable number of points within the domain of the probability density function, using Leibniz’s Formula, the partial derivatives in the above equation can pass through the integral. Therefore, the integrals in equation (13) are constant with respect to α and β and therefore their difference is 0. Hence, conditions (i) and (ii) hold. Conversely, if J ≥ 3, a counter example to the condition that 1 2 ( ) j j E H − H does not depend on j is generated for symmetric distributions by letting α1 =  α2, β1 =  β2 and βj = 0 for 3 ≤ j ≤ J . Then 11 21 12 22 13 23 E (H − H ) = E (H − H ) ≠ E (H − H ) . Counterexamples for I ≥ 3 and for nonsymmetric distributions are handled similarly. This concludes Thompson’s proof of Corollary 4. Thompson proved that when only one main effect was present, or if each main effect had only two levels if both main effects were present, the asymptotic distribution 27 of the rank transform statistic, T, was 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + by Lemma 1 and Lemma 2. Lemma 1 stated that the aij. were normally distributed. Lemma 2 stated that the denominator of T, (IJ – I – J + 1)D converges in probability to a constant. Thompson assumes that the aij.’s are also independent, so the square of their summed values, and therefore T, has a chisquare distribution. Conover and Iman (1976) use a similar test statistic with the ranked values and state that the test statistic has an asymptotic chisquared distribution, but they do not specifically state that their ranked values are independent. One goal is to determine if the aligned rank transform allows for more than two levels of each main effect when both effects are present. Using a similar alignment as that in equation (1), but removing the subject, using the intervals for i and j that were defined by Thompson, and defining * ij X as the aligned value of observation Xij, we see the following for the alignment: * ij ij i. . j .. X = X − X − X + X ( ) i j ij ijn =θ +α + β + αβ +ε 1 . 1 ( ( ) ) J j i j ij ij J θ α β αβ ε = − Σ + + + + 1 . 1 ( ( ) ) I i i j ij ij I θ α β αβ ε = − Σ + + + + 1 1 . 1 ( ( ) ) I J i j i j ij ij IJ θ α β αβ ε = = + ΣΣ + + + + ( ) i j ij ijn =θ +α + β + αβ +ε 28 1 1 1 . 1 1 1 ( ) J J J j j j i j ij ij J J J θ α β αβ ε = = = − − Σ − − Σ − Σ 1 1 1 . 1 1 1 ( ) I I I i i i i i j ij j I I I θ α β αβ ε = = = − − − Σ − Σ − Σ 1 1 1 1 1 1 . 1 1 1 1 ( ) ( ) I J I J I J i j i j i j i j ij ij J I IJ IJ θ α β αβ ε = = = = = = + + Σ + Σ + Σ Σ + Σ Σ This can simplify under the conditions of Thompson, . 0 i i α = Σα = , . 0 j j β = Σβ = , . ( ) ( ) 0 j i ij αβ = Σ αβ = and . ( ) ( ) 0 i j ij αβ = Σ αβ = . Under these conditions, the alignment becomes: * ij X ( ) i j ij ijn = θ + α + β + αβ + ε 1 . 1 0 0 J j j ij J θ β ε = − − − − − Σ 1 . 1 0 0 I i i ij I θ α ε = − − − − − Σ 1 1 . 1 0 0 0 I J i j i j IJ θ ε = = + + + + + Σ Σ 1 1 1 1 . . . 1 1 1 ( ) J I I J j i i j ij ijn ij ij ij J I IJ α β ε ε ε ε = = = = = + − Σ − Σ + Σ Σ Under the null hypothesis of no interactions, (αβ)ij = 0, this further simplifies to: 1 1 1 1 * . . . 1 J 1 I 1 I J j i i j i j i jn i j ij i j X J I IJ ε ε ε ε = = = = = − Σ − Σ + Σ Σ Thompson defines the distribution of Xijn under the null hypothesis as ( ) ( ) ij i j F x = F x −θ −α − β . After alignment, we see the distribution of * ijn X under the 29 null hypothesis is Fij ( x* ) = F ( x* ' ) where *' * i j x = x −θ −α − β and * * ( ( )) ( ( )) 0 ij E F x = E F x = . Using this alignment, we can recreate the work of Thompson. First, we define * * * . 1 ( ) ( ) 1 i n ij ij jn e E a E R IJN = = + Σ , where * ijn R is the aligned rank of Xij. Note that we do not need to redefine H(x), which was the average distribution function, since we have only changed the notation of our random variable to * x . Therefore, we also do not need to redefine ij μ or ij ν in terms of the alignment since both are defined using H(x). Although we do not need to redefine H(x), we will denote * ( ) ij H x as * ij H . By replacing our definitions in the proof of Theorem 3, we can obtain the results of the Theorem for the aligned rank transform. We will redefine the following using the aligned ranks, * ijn R , * * ( ) / 1 ijn ijn a = R IJN + , 2 1 1 * * * * * . . . . . . . . 1 J I 1 1 1 j i i j i j Q a a a a N = = J I I J = − − + Σ Σ , 2 1 1 1 * * * . 1 N J I 1 n j i i jn i j D a a I JN IJ = = = N = − − Σ Σ Σ , and the statistic * * ( 1) * Q T I J I J D = − − + . Notice that the definition of * ijn a depends only on the ranked values and the number of observations. Conover and Iman (1976) showed that the aligned rank yields independent 30 observations. Therefore, our aligned ranked values are still independent ranked values and thus the * ijn a are still independent as defined in Q* and utilized by Thompson. Let * * * 11. . ( , ..., ) IJ a = a a ′ and 11. . ( , ..., ) IJ μ = μ μ ′ where * 1 1 * 1 ( ) ( ( )) I J a b ij ij ab ij N E H N E F X IJ μ = = = × = × Σ Σ . Let * (i , j ) γ be the square root of the (i, j)th diagonal element of the covariance matrix Γ* where the (i, j), (r, s)th element of Γ* is * * * * 1 1 1 1 1 1 cov ( ), ( ) J I J I v u v u ij ij uv rs rs uv H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Also let * 2 ( i , j ) γ be the (i, j)th diagonal element of Γ*. Since 0 < var(H* ij) < ∞, then 0 < * (i , j ),( r ,s ) γ < ∞. As with Thompson’s work, we will state and prove two lemmas in order to show that our test statistic has a χ 2 distribution. Lemma 1: Under the null hypothesis, 1 2 * * . ( , ) ( ) i j i j i j N a μ γ − − converges in distribution to N (0,1) . Proof: Apply Theorem 3.3 from Thompson and Ammann (1989) to the linear rank statistic * ij. a with Wilcoxon scores. The regularity conditions of Theorem 3.3 should still hold since we have only changed the location parameters using our alignment. In particular, the score function, more specifically the alignment, has a bounded second derivative and constants that do not depend on n or N. From Theorem 3.3, we know that 1 2 * * . ( , ) ( ) ij i j i j N a μ γ − − converges in distribution to N(0,1) if * 2 ( , ) 1 lim ( ) 0 N i j N γ →∞ > . Thompson 31 (1991) showed that 2 ( , ) 1 lim ( ) 0 N i j N γ →∞ > . Recall that * * 1 ( ) ( ) i j ij H x F x IJ = ΣΣ and Fij ( x * ) = F ( x * ' ) where *' * i j x = x −θ −α − β . Since * ( i , j ) γ is defined using only the average distribution function H* (x) and the distribution function * ( ) ij F x , the limit should not change with our definition of * ( i , j ) γ . Thus * 2 ( , ) 1 lim ( ) 0 N i j N γ →∞ > . We also know that from Hajek (1968), * * ( , ) . var( ) (1)max i j ij ijn γ − a ≤ O d − d , where dijn are constants that under the assumptions of Theorem 3.3 do not depend on n or N and d is the average of the dijn. Since , , max i j n ijn d − d does not depend on N, then since * ( i , j ) γ →∞, var( * ij . a )→∞ as N→∞. So, with * ij . a substituted in for SN in Theorem 3.2 (see appendix) of Thompson and Ammann (1989), Theorem 3.2 holds for all N sufficiently large and thus 1 2 * * . ( , ) ( ) i j i j i j N a μ γ − − converges in distribution to N(0,1). Lemma 2: Under the null hypothesis of no interaction, D* converges in probability to the nonnegative, finite constant { }2 2 * * 1 1 1 ( ) va r( ) 3 ij ij E H H IJ IJ σ = − Σ Σ = Σ Σ Proof: This follows from Thompson’s proof of Lemma 2 (1991) which is almost identical to the proof of Theorem 5.3 of Thompson and Ammann (1989) by using the linear rank statistic * ij. a with Wilcoxon scores. D* can be considered as an ANOVAtype sum of squares that is based on a different variable that is scalesimilar to D and any convergence in probability should be preserved. Therefore if D, as defined as in 32 Thompson (1991), converges in probability to a constant, then D* will also converge in probability to a constant. Under the null hypothesis of no interactions, T* converges in distribution to 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + by Lemma 1 and Lemma 2. Thompson (1991) showed that the ranked data converged to a χ 2 distribution by Lemma 1 and 2 of Thompson. We have proved that Lemma 1 and 2 still hold for the aligned ranks. Therefore, the test statistic T* for the aligned values converges to 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + . Simulation studies were run for a double exponential error term with a compound symmetric covariance structure with various levels of N. The studies showed that as N increased (3, 10, 15, 30 and 45), in particular as the number of subjects increased, the error rate for the test of interactions approached the 0.05 level. Compound Symmetric Covariance Structure – 10000 repetitions Test for Interaction Treatment and Repeated Measures Main Effects Present Double Exponential Error Terms Bolded Values represend observed error rates that are within 2 standard errors of 0.05 Number of Subjects Total Number of Observations Observed Error Rate 3 37 0.049 10 90 0.042 15 135 0.054 30 270 0.047 45 405 0.048 Table 1 33 Theorem 3: Under the null hypothesis of no interaction, lim ( ) N E T →∞ is finite if and only if (i) * * ( ) ij aj E H − H does not depend on j for all 1 ≤ i, a ≤ I and 1 ≤ j ≤ J (ii) * * ( ) ij ib E H − H does not depend on i for all 1 ≤ i ≤ I and 1 ≤ j,b ≤ J Proof: Define an IJ x IJ matrix A as having elements 1 1 1 (i, r ) ( j , s ) ( j , s ) (i, r ) I J IJ δ δ − δ − δ + where δ(i,r) = 1 if i = r and 0 if i ≠ r. Then * E (Q ) is finite if and only if = O ( N ) * * e 'A e where * * * 1 1 ( , ..., ) IJ e = e e with * * . ( ) ij ij e = E a . Note that * * * * 2 . . .. 1 1 1 ( ) ( ) ij i j e e e e O N J I IJ = Σ Σ − − + = * * e 'Ae is equivalent to 1 * * * * 2 . . .. 1 1 1 ( ) ij i j e e e e O N J I IJ − − + = for all i and j. Applying Theorem 3.3 of Thompson and Ammann (1989) to * ij. a we see that * * * . ( , ) ( , ) d ij ij i j a →N e γ and * * * . ( , ) ( , ) d ij ij i j a →N μ γ . Applying this result to Lemma 1.5.5.A of Serfling (1980), we see that * * ( , ) lim 0 N ij ij i j e μ →∞ γ − = where * * 1 1 1 ( ) ( ( )) ( ) I J a b ij ij ab ij ij N E H N E F X N E H IJ μ = = = × = × Σ Σ = × and * (i , j ) γ is the square root of the (i, j)th diagonal element of the covariance matrix Γ where the (i, j), (r, s)th element of Γ is 34 * * * * 1 1 1 1 1 1 cov ( ), ( ) J I J I v u v u ij ij uv rs rs uv H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Because 0 < * (i , j ) γ < ∞, both * ij e and * ij μ converge to the same limit as N increases. Therefore, * * * * . . .. 1 1 1 ij i j e e e e J I IJ − − + is 1 O(N 2 ) if and only if . . .. 1 1 1 ij i j J I IJ μ − μ − μ + μ is 1 O(N 2 ) , which is equivalent to . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = for all i and j where * ( ) ij ij ν = E H . To obtain (i), subtract . . .. 1 1 1 0 aj a j J I IJ ν − ν − ν + ν = from . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = . This gives * * . . 1 ( ) ( ) ij aj ij aj J i a E H −H =ν −ν = ν −ν which does not depend on j for all i and j. Thus, if . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = , * * ( ) ij aj E H − H does not depend on j for all i and j. To show the other direction, we will first assume that . . .. 1 1 1 ( ) 0 ij i j J I IJ ν − ν − ν + ν = f j ≠ for some j, say jʹ. If we then subtract . . .. 1 1 1 0 aj a j J I IJ ν ν ν ν ′ ′ − − + = from . . .. 1 1 1 ( ') 0 ij i j J I IJ ν ν ν ν f j ′ ′ − − + = ≠ , we see that . . 1 1 ( ') 0 ij aj i a v v f j J J ν ν ′ ′ − − + = ≠ . This means that * * ( ) ij aj E H − H depends on j for some value of j. Since . . .. 1 1 1 ( ) 0 ij i j J I IJ ν − ν − ν + ν = f j ≠ for this value of 35 j, then . . .. 1 1 1 ij i j J I IJ μ − μ − μ + μ is not 1 O(N 2 ) for all i and j, * * * * . . .. 1 1 1 ij i j e e e e J I IJ − − + is not 1 O(N 2 ) for all i and j, and thus * E (Q ) is not finite. The result for (ii) is obtained similarly. This completes the proof. The goal is to now show that Theorem 3 holds when both main effects are present, even if more than two levels of each main effect are present. Corollary 4: When both main effects are present, conditions (i) and (ii) of Theorem 3 are satisfied for all values of αi and βj for any number of levels i or j. Proof: Assume I=2, J=3. Conditions (i) and (ii) are equivalent to * * * * * * 11 21 12 22 13 23 E(H − H ) = E(H − H ) = E(H − H ) . First we will show * * * * 11 21 12 22 E(H − H ) − E(H − H ) = 0 . * * * * * * * * 11 21 12 22 11 21 12 22 E(H − H ) − E(H − H ) = E(H ) − E(H ) − E(H ) + E(H ) { } 1 1 * * * * 11 21 12 22 1 ( ( ) ( ) ( ) ( ) ) I J a b ab ab ab ab E F x F x F x F x IJ = = = ΣΣ − − + { } 1 1 * * * * 11 21 12 22 1 ( ( )) ( ( )) ( ( )) ( ( )) I J a b ab ab ab ab E F x E F x E F x E F x IJ = = = ΣΣ − − + = 0 Similarly, * * * * 12 22 13 23 E(H − H ) − E(H − H ) = 0 and * * * * 11 21 13 23 E(H − H ) − E(H − H ) = 0. Results for I = 3, J = 2 can be obtained in a similar manner. Therefore, conditions (i) and (ii) of Theorem 3 are satisfied when one main effect has three levels. When there are three or more levels for each main effect, any 36 nontrivial difference of Hij’s will have an expected value of zero. We will consider the case when I = 3 and J = 3. For this case, we need to show that * * * * * * E(H11 − H21 ) = E(H12 − H22 ) = E(H13 − H23 ) , * * * * * * 11 31 12 32 13 33 E(H − H ) = E(H − H ) = E(H − H ) , and * * * * * * 21 31 22 32 23 33 E(H − H ) = E(H − H ) = E(H − H ) . First consider * * 1 2 ( ) j j E H − H , where j = 1, 2, 3. We know * * 1 2 ( ) j j E H − H { * * } 1 1 1 2 1 ( ( ) ( ) ) I J a b ab j ab j E F x F x IJ = = = ΣΣ − { * * } 1 1 1 2 1 ( ( )) ( ( )) 0 I J a b ab j ab j E F x E F x IJ = = = ΣΣ − = . For * * 1 3 ( ) j j E H − H , where j = 1, 2, 3, we see * * 1 3 ( ) j j E H − H { * * } 1 1 1 3 1 ( ( ) ( ) ) I J a b ab j ab j E F x F x IJ = = = ΣΣ − { * * } 1 1 2 3 1 ( ( )) ( ( )) 0 I J a b ab j ab j E F x E F x IJ = = = ΣΣ − = . And for * * 2 3 ( ) j j E H − H , where j = 1, 2, 3, we see * * 2 3 ( ) j j E H − H { * * } 1 1 2 3 1 ( ( ) ( ) ) I J a b ab j ab j E F x F x IJ = = = ΣΣ − { * * } 1 1 2 3 1 ( ( )) ( ( )) 0 I J a b ab j ab j E F x E F x IJ = = = ΣΣ − = . Results for more than three levels of main effects can be proven similarly. Thus, the conditions of (i) and (ii) of Theorem 3 are satisfied for any number of levels of the main effects. 37 Lemma 1 stated that the * ij. a terms were normally distributed and Lemma 2 stated that the denominator of T* converges in probability to a constant. Therefore, by Lemma 1 and 2, the test statistic T* for the aligned values converges to 2 ( IJ I J 1) k χ − − + × where ( 1) 1 IJ I J k − − + = . The Analysis of Variance analog from Thompson supports the notion that this has IJ – I – J +1 degrees of freedom. Thus, T* will converge to this distribution no matter how many levels there are of the main effects. 38 CHAPTER IV SIMULATIONS A Monte Carlo study of the Type I error rates and power of four tests for interaction in a 3×3×3 completely randomized, balanced repeated measures experiment was conducted using SAS Version 9.1.3 (SAS Institute, Cary, NC). Five initial conditions were tested; no main effects or interactions, only treatment main effects, only repeated measures main effects, both treatment and repeated measures main effects, and only interactions. In addition to the initial conditions, four distributions were used for the error terms; normal, uniform, F and double exponential. These error distributions were selected to represent different values of kurtosis. Kurtosis is a measure of the level of peakedness or flatness of data values in the center of the graph of the distribution versus the tails of the graph when compared to the normal distribution. Distributions with higher kurtosis have heavier tails or more extreme values, while distributions with lower kurtosis have heavier middles or fewer extreme values. The normal distribution has a kurtosis of 3, the uniform distribution has a kurtosis of 1.2, an Fdistribution with parameters 3 and 5 has a kurtosis of 14, and the double exponential distribution has a kurtosis of 3. In addition to the error distributions and initial conditions, three covariance structures were used: variance components (VC), compound symmetric (CS), and a firstorder autoregressive (AR(1)). For the first order autoregressive structure, three values of ρ were considered, 0.75, 0.5 and 0.25. 39 Four tests were then used to test for interactions, the traditional Ftest, the rank transform (RT), the aligned rank transform using Higgins and Tashtoush’s (1994) naïve alignment for a completely randomized design, and the aligned rank transform using Higgins and Tashtoush’s alignment for a repeated measures design. Higgins and Tashtoush’s naïve alignment, .. . . .. ... ARYijk = Yijk −Yi −Y j −Y k + 2*Y , will be denoted ART1 and the aligned rank transform for a repeated measures design, ijk ijk ij. ..k ... ARY = Y −Y −Y +Y , will be denoted ART2. Higgins and Tashtoush showed that the naïve alignment has power advantages over the standard Ftest when wholeplot variances are smaller, but can lose power as the variances get larger. They also showed that the aligned rank transform for repeated measures had larger power than the standard Ftest for heavy tailed distributions. Their simulations also showed that the naïve alignment and repeated measures alignment has comparable power for many distributions when the wholeplot error variances were small, but the repeated measures alignment performs better when the error variance get larger. Therefore, both methods of Higgins and Tashtoush were used for comparison since various error distributions and specific values of the whole plot standard deviation were applied to the data. Simulation Results A total of 100 cases were considered from the five initial conditions, four error term distributions and five covariance structures combinations. Ten thousand repetitions were generated for each of the 100 cases and then the four tests were run on each repetition. Three levels of the treatment main effect, three subjects per treatment, and three repeated measures per subject were used for each repetition. For the variance 40 components covariance structure, the variance was assumed to be 1. For the compound symmetric covariance structure, σ2 was assumed to be 9 and σ1 2 was assumed to be 4. For the autoregressive covariance structures, the variance was assumed to be 1 and three values of ρ were used, 0.25, 0.5 and 0.75. When treatment main effects were present, the treatment 1 effect was 1, the treatment 2 effect was 2, and the treatment 3 effect was 4. When repeated measures main effects were present, the repeated measures 1 effect was 0, the treatment 2 effect was 1, and the treatment 3 effect was 1. When interactions were present, the effects for treatment 1 were 1, 2, 3, for treatment 2 were 2, 1, 2 and for treatment 3 were 3, 2, 1 where the first number listed for each treatment is for the repeated measure 1 effect, the second number is the repeated measure 2 effect and the third number is the repeated measure 3 effect. For all covariances except the variance components structure, at least one of the tests for each initial condition and error term distribution yielded less than ten thousand results due to the NewtonRaphson algorithm used to find the minimum of 2 times the logarithm of the restricted likelihood function not converging. The minimum number of repetitions that converged was 7640. Tables 2 through 6 give the simulation results for each of the 100 cases. Table 2 summarizes the results for all four error distributions and all five tests per distribution for the variance components covariance structure. Table 3 summarizes the results for the compound symmetric covariance structure. Summarizing the results for the autoregressive covariance structures are Table 4 using ρ = 0.75, Table 5 using ρ = 0.5, and Table 6 using ρ = 0.25, where ρ is the correlation between adjacent observations on the same subject. 41 For all four distributions of the error terms, the ART1 had error rates that were closer to the desired 5 percent significance level than the ART2, with the exception of the Fdistribution with a compound symmetric covariance structure. While the ART2 was a powerful test, it had error rates above the desired 0.05 level, except in the case of the compound symmetric covariance structure. However, in this case, there were only approximately 7640 repetitions. Therefore, it was not a 0.05 test for any of our error distribution and covariance structure combinations, so it will be excluded from further discussion. For normal error terms, while the error rates were above 5 percent for the ART1 for all covariance structures, they were less than 6.5 percent. In fact, for all covariance structures except the autoregressive with ρ=0.75, the error rates were less than or equal to 5.75 percent. For all three autoregressive covariance structures, the ART1 had error rates that were closer to the 5 percent level than the standard F test or the RT (See Tables 4, 5 and 6). For the variance components and compound symmetric covariance structures, the ART1 had error rates that were larger than the standard F test or the RT. However, the error rate for the ART1 was less than or equal to 5.75 percent and was within 1 percent of the error rates for the other two tests. For uniform error terms, the ART1 had error rates similar to the standard F test. However, both tests had error rates higher than 5 percent but less than 8.9 percent. For sixteen of twenty covariance structures and initial effect combinations, the error rates were closer to the 5 percent level for the ART1 than for the standard F test. The error rates were slightly higher for the ART1 as opposed to the RT in all but four combinations, but the error rates for the ART1 in these situations were within 1 percent of the RT. 42 For F error terms, the ART1 had rates below 5 percent for the variance components and compound symmetric covariance structures (See Tables 2 and 3). The error rate for the ART1 was closer to the 5 percent level than the standard F test or the RT. The error rate for the standard F test was around 2 percent, while the RT had error rates around 4 percent, except when both main effects were present. In that case, the error rate for the RT was around 6 percent. For the autoregressive covariance structures, the ART1 had error rates closer to the 5 percent level than the standard F test and the RT in seven of the twelve error distribution and covariance structure combinations (See Tables 4, 5, and 6). In those cases where the ART1 was not the closest error rate, the RT was the closest to the 5 percent level, but the ART1 was within 0.2 percent of the RT in all but one case where it was within 0.6 percent. For double exponential error terms, the error rate for the ART1 was higher than the 5 percent level for the variance components covariance structure, but it was less than 5.8 percent (See Table 2). Both the standard F test and the RT had error rates closer to and below the 5 percent level with the RT being closer to 5 percent. For the compound symmetric covariance structure, all three tests had error rates below the 5 percent level, with the ART1 having error rates closer to 5 percent except when both main effects were present (See Table 3). In this case, the RT had an error rate of exactly 5 percent. For the autoregressive covariance structures, the ART1 had error rates that were further from the 5 percent level than the standard F test and in all but two cases, the error rates were further from the 5 percent level than the RT (See Tables 4, 5, and 6). However, all three tests had error rates between 6.5 and 9 percent. 43 Although the standard F test, RT and ART1 were not true 0.05 tests in many of our error distribution and covariance structure combinations, we would still like to examine the power of these tests. For normal error terms, the ART1 had power larger than the RT, but lower than the standard F test for the compound symmetric and variance components covariance structures (See Tables 2 and 3). For all three autoregressive covariance structures, the ART1 had the lowest power of the three tests, while the power for the ART1 for all five covariance structures was within 11.5 percent of the other two tests (See Tables 4, 5 and 6). Although the power was smaller in these cases, recall that the ART1 had error rates closer to the 5 percent level. For uniform error terms, the power for the ART1 was higher than the power of the RT, while the standard F test had the highest power. In the three cases where the power for the ART1 was at least 10 percent greater than the RT, the error rates of both tests were within 1 percent of each other. In the other two cases, the power for the ART1 was between 4.4 percent and 6 percent greater than the RT. In these cases, the error rates for the ART1 were within 0.6 percent of the RT. Recall that the error rates for the standard F test and the ART1 were similar. For F error terms, the ART1 had power that was greater than the standard F test, but less than the RT. Recall that the ART1 had error rates below 5 percent for the variance components and compound symmetric covariance structures (See Tables 2 and 3). The ART1 also had error rates closer to the 5 percent level than the RT or standard F test in seven of the twelve error distribution and covariance structure combinations for the autoregressive covariance structures (See Tables 4, 5 and 6). Also recall that for all combinations, the error rate for the ART1 was closer to the 5 percent level than the 44 standard F test. The ART1 also had error rates closer than the 5 percent level in seven of the twelve error distribution and covariance structure combinations and was within 0.6 percent of the error rate for the RT when the RT was the closest to the 5 percent level. For double exponential error terms, the ART1 had higher power than the standard F test. The ART1 also had higher power than the RT except for the autoregressive covariance structure when ρ=0.75. In this case, the power for the ART1 was less than 0.6 percent smaller than the RT. Recall that for the variance components covariance structure, the error rates for the RT were closest to the 5 percent level, while the standard F test had error rates less than the RT and the ART1 had error rates greater than the 5 percent level and greater than the RT. For the autoregressive covariance structures, all three tests had error rates between 6.5 and 9. 45 Variance Components Covariance Structure – 10000 repetitions Test for Interaction – Observed Error Rates Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0502 0.0522 0.0204 0.0435 Ranked 0.0508 0.0522 0.0381 0.0464 ART1 0.0563 0.0520 0.0424 0.0572 ART2 0.1352 0.1395 0.0929 0.1287 Treatment Main Effects Standard Test 0.0524 0.0522 0.0204 0.0435 Ranked 0.0515 0.0497 0.0396 0.0469 ART1 0.0575 0.0520 0.0424 0.0572 ART2 0.1343 0.1395 0.0929 0.1287 Repeated Measures Main Effects Standard Test 0.0524 0.0522 0.0204 0.0435 Ranked 0.0489 0.0484 0.0397 0.0466 ART1 0.0575 0.0520 0.0424 0.0572 ART2 0.1343 0.1395 0.0929 0.1287 Treatment and RM Main Effects Standard Test 0.0524 0.0522 0.0204 0.0435 Ranked 0.0526 0.0524 0.0632 0.0470 ART1 0.0575 0.0520 0.0424 0.0572 ART2 0.1343 0.1395 0.0929 0.1287 Interactions Standard Test 0.6762 0.5627 0.4162 0.4026 Ranked 0.6318 0.4441 0.6657 0.4365 ART1 0.6731 0.4886 0.5396 0.4515 ART2 0.8473 0.7545 0.6539 0.6247 Table 2 46 Compound Symmetric Covariance Structure – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9995 **  Less than 10000 repetitions, more than 7640 Rates within 2 standard errors (0.0044, 0.005) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0507 0.0473 0.0371 0.0485 ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Treatment Main Effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0525 0.0514 0.0410 0.0461* ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Repeated Measures Main Effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0496 0.0490 0.0421 0.0456 ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Treatment and RM Main Effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0557 0.0523 0.0711 0.0500 ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Interactions Standard Test 0.8239 0.7261 0.4948 0.5347 Ranked 0.7729 0.5153 0.7393 0.5053 ART1 0.7925* 0.6347 0.6184 0.5503* ART2 0.8427** 0.7465** 0.6204** 0.5872** Table 3 47 Autoregressive Covariance Structure, ρ=0.75 – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9970 Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0815* 0.0807* 0.0372* 0.0657* Ranked 0.0756* 0.0711* 0.0600* 0.0661* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Treatment Main Effects Standard Test 0.0815* 0.0809* 0.0372* 0.0657* Ranked 0.0840* 0.0949* 0.0658* 0.0765* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Repeated Measures Main Effects Standard Test 0.0815* 0.0809* 0.0372* 0.0657 Ranked 0.0770* 0.0691* 0.0548* 0.0677* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Treatment and RM Main Effects Standard Test 0.0815* 0.0805* 0.0372* 0.0657* Ranked 0.0852* 0.0730* 0.1102* 0.0900* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Interactions Standard Test 0.9115* 0.8671* 0.6149* 0.6616* Ranked 0.8949* 0.4747* 0.7778* 0.7015* ART1 0.8872 0.7979* 0.6851* 0.6946* ART2 0.9666 0.9379 0.8104 0.8198 Table 4 48 Autoregressive Covariance Structure, ρ=0.5 – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9970 Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0788* 0.0820* 0.0288* 0.0667* Ranked 0.0760 0.0743 0.0543 0.0725 ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Treatment Main Effects Standard Test 0.0788* 0.0820* 0.0288* 0.0666* Ranked 0.0794* 0.0781* 0.0590* 0.0677* ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Repeated Measures Main Effects Standard Test 0.0788* 0.0818* 0.0288* 0.0667* Ranked 0.0767* 0.0781* 0.0536* 0.0711* ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Treatment and RM Main Effects Standard Test 0.0788* 0.0816* 0.0288* 0.0666* Ranked 0.0815* 0.0808* 0.0968* 0.0762* ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Interactions Standard Test 0.8542* 0.7765* 0.5351* 0.5863* Ranked 0.8172* 0.5496* 0.7502* 0.6077* ART1 0.7789 0.7035 0.6374 0.6079 ART2 0.9529 0.9011 0.7549 0.7778 Table 5 49 Autoregressive Covariance Structure, ρ=0.25 – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9970 Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0790* 0.0888* 0.0270* 0.0681* Ranked 0.0771* 0.0795* 0.0541* 0.0697* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Treatment Main Effects Standard Test 0.0790* 0.0887* 0.0270* 0.0683* Ranked 0.0811* 0.0829* 0.0576* 0.0727* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Repeated Measures Main Effects Standard Test 0.0790* 0.0890* 0.0270* 0.0683* Ranked 0.0791* 0.0800* 0.0517* 0.0707* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Treatment and RM Main Effects Standard Test 0.0790* 0.0886* 0.0269* 0.0684* Ranked 0.0800* 0.0808* 0.0893* 0.0736* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Interactions Standard Test 0.7713* 0.6702* 0.5132* 0.5122* Ranked 0.7320* 0.5455* 0.7237* 0.5341* ART1 0.6694 0.6052* 0.6175* 0.5439 ART2 0.9118* 0.8372 0.7297 0.7134* Table 6 50 CHAPTER V CONCLUSION The objectives of this paper were 1) to find how the alignment for the aligned rank transform affects the repeated measures model, 2) to find the variance of the aligned observations, 3) to find the asymptotic distribution of the aligned rank transform test in a factorial setting, and 4) compare the standard test, rank transform test, and two approaches to the aligned rank transform test in analyzing a repeated measures design through Monte Carlo simulations. Objectives 1, 2, and 3 were covered in Chapter 3. In particular, we found that the aligned rank transform test had an asymptotic distribution that was 2 χ ( IJ I J 1) / ( IJ I J 1) − − + − − + . The results of the Monte Carlo simulation found that the error rates for the ART1 performed closer to the desired 5 percent significance than the ART2 for all covariance structures and all error distributions examined in this work, with the exception of one combination, the compound symmetric covariance structure and the Fdistribution. While the ART2 was a powerful test, it was not a 0.05 test as in all but one case, the error rates were larger than 0.05. Therefore, it was excluded from further discussion. For normal error distributions, the ART1 had error rates closer to the 5 percent level than the standard F test and the RT for the autoregressive covariance structures. For the variance components and compound symmetric covariance structures, the ART1 was within 1 51 percent of the 5 percent level, the standard F test error rate, and the RT error rate. For uniform error distributions, the ART1 was within 1 percent of the 5 percent level, the standard F test error rate, and the RT error rate for the variance components and compound symmetric covariance structures. For the autoregressive covariance structures, the ART1 had error rates closer to the 5 percent level than the standard F test and was within 1 percent of the error rates for the RT when the RT had error rates closer to the 5 percent level. For the Fdistribution, the ART1 had error rates closer to the 5 percent level than the standard F test for all five covariance structures. The ART1 also had error rates closer to the 5 percent level than the RT except for five cases in the autoregressive covariance structures. In these cases, the ART1 error rate was within 0.6 percent of the RT error rate. For the double exponential distribution, the standard F test had error rates closer to the 5 percent level than the RT or the ART1, but all three tests had error rates between 6.5 and 9 percent. If the error terms have normal, uniform, or F distributions, but the covariance structure is not known or not spherical, the ART1 should be used to test for interactions. If the covariance structure is spherical and the error terms are normal or uniform, the standard F test and the RT have slightly lower error rates than the ART1. For error terms that have an F distribution with spherical covariance structures, the ART1 should be used to test for interactions. If the error terms have a double exponential distribution and the covariance structure is unknown or is nonspherical, then the standard F test should be used to test for interactions. If the covariance structure is spherical, then the ART1 should be used to test for interactions. Overall, when testing for interactions in a repeated 52 measures design, especially in cases where the covariance structure is not known to be spherical and the error distributions are not light tailed, the ART1 should be used. Further studies of the effects of the covariance structure on tests for interaction in a repeated measures design could include investigating the results for an unstructured covariance structure. Since our simulation results suggest that ART1 performs better than the ART2, there should be further research into the effects of the naïve alignment on the model using Kroenecker product definitions and the effects of the naïve alignment on the works of Thompson (1991). 53 REFERENCES Agresti, A. and Pendergast, J. (1986). “Comparing Mean Ranks for Repeated Measures Data.” Communications in Statistics: Theory and Methods. 15, 14171433. Akritas, M.G. (1990). “The Rank Transform Method in Some TwoFactor Designs.” Journal of the American Statistical Association. 85, 7378. Akritas, M.G. (1991). “Limitations of the Rank Transform Procedure: A Study of Repeated Measures Designs, Part I.” Journal of the American Statistical Association. 86, 457460. Baguley, Thom (2004). “An Introduction to Sphericity.” Retrieved September 1, 2008 from http://www.ps.uci.edu/~markm/statistics/spheric.pdf. Bartlett, M.S. (1936). “The square root transformation in analysis of variance.” Supplement to the Journal of the Royal Statistical Society. 3, 6878. Bartlett, M.S. (1947). “The use of transformations.” Biometrics. 3, 3952. Beasley, T. M. (2000). “Nonparametric tests for analyzing interactions among intrablock ranks in multiple group repeated measures designs.” Journal of Educational and Behavioral Statistics. 25, 2059. Blair, R.C., Sawilowsky, S.S. and Higgins, J.J. (1987). “Limitations of the Rank Transform Statistic.” Communications in Statistics. B16, 11331144. Collier, R.O. Jr., Baker, F.B., Mandeville, G.K. and Hayes, T.F. (1967). “Estimates of test size for several test procedures based on conventional variance ratios in the repeated measures design.” Psychometrika. 32, 339353. Conover, W.J. and Iman, R.L. (1976). “On Some Alternative Procedures Using Ranks for the Analysis of Experimental Designs.” Communications in Statistics. A5, 14, 1349 1368. Conover, W.J. and Iman, R.L. (1981), “Rank Transformations as a bridge Between Parametric and Nonparametric Statistics.” American Statistician. 35, 124133. Conover, W.J. (1999). Practical Nonparametric Statistics (Third Edition). New York:Wiley. 54 Girden, E.R. (1992). ANOVA: Repeated Measures. Sage university paper series on qualitative applications in the social sciences, 84, Newbury Park, CA: Sage. Greenhouse, S.W. and Geisser, S. (1959). “On Methods in the Analysis of Profile Data.” Psychometrika, 24, 95112. Hajek, J. (1968). “Asymptotic Normality of Simple Linear Rank Statistics Under Alternatives.” The Annals of Mathmatical Statistics, 39, 325346. Harwell, M.R. and Serlin, R.C. (1994). “A Monte Carlo Study of the Friedman Test and Some Competitors in the Single Factor, Repeated Measures Design with Unequal Covariances.” Computational Statistics and Data Analysis, 17, 3549. Hettmansperger, T.P., (1984). Statistical Inference Based on Ranks. New York: Wiley. Higgins, J. J. and Tashtoush, S. (1994). “An Aligned Rank Transform Test for Interactions.” Nonlinear World, 1, 201211. Huynh, H. and Feldt, L.S. (1976). “Estimation of the Box Correction for Degrees of Freedom from Sample Data in Randomized Block and Splitplot Designs.” Journal of Educational Statistics, 1 (1), 6982. Iman, R.L. (1974). “A Power Study of a Rank Transform for the TwoWay Classification Model When Interaction May Be Present.” Canadian Journal of Statistics, 2, 227 239. Iman, R.L., Hora, S.C., Conover, W.J. (1984). “Comparison of Asymptotically DistributionFree Procedures for the Analysis of Complete Blocks.” Journal of the American Statistical Association, 79, 674685. Keselman, H.J., Algina, James, Kowalchuk, Rhonda K. (2001). “The Analysis of Repeated Measures Designs: A review.” British Journal of Mathematical and Statistical Psychology, 54, 120. Keselman, J.C., Lix, L.M., and Keselman, H.J. (1996). “The Analysis of Repeated Measurements: A Quantitative Research Synthesis.” British Journal of Mathematical and Statistical Psychology, 49, 275298. Kuehl, Robert (2000). Design of Experiments: Statistical Principles of Research Design and Analysis, Second Edition. Brooks/Cole. Mansouri, H. and Chang, G.H. (1995). “A Comparative Study of Some Rank Tests for Interaction.” Computational Statistics and Data Analysis, 19, 8596. 55 Mauchly, J.W. (1940). “Significance test for sphericity of a normal nvariate distribution.” Annals of Mathematical Statistics, 11, 204209. Maxwell, S.E. and Delaney (1990). Designing Experiments and Analyzing Data. Belmont, CA: Wadsworth. Serfling, R.J. (1980). Approximation Theorems of Mathematical Statistics. New York: Wiley. Stevens, J. (1992). Applied Mutivariate Statistics for the Social Sciences (Second edition). Hillsdale, NJ: LEA. Thompson, G.L. (1991). “A note on the rank transform for interactions.” Biometrika, 78, 697701. Thompson, G.L. and Ammann, L.P. (1989). “Efficacies of rank transform statistics in twoway models with no interactions.” Journal of the American Statistical Association, 84, 325330. Wilcox, R. R. (1998). “How many discoveries have been lost by ignoring modern statistical methods?” American Psychologist, 53, 300–314. Zimmerman, D.W. and Zumbo, B.D. (1993). “Relative Power of the Wilcoxon Test, the Friedman Test and Repeated Measures ANOVA on Ranks.” Journal of Experimental Education, 62, 7586. 56 APPENDICES 57 A.1 THEOREMS The following theorems were referenced in the paper and are stated here for clarification. All the following are from Thompson and Amman (1989): Let I be the number of blocks, J the number of treatments and N the number of replications for a twoway layout. Theorem 3.1: Let SN be a linear rank statistic such that 1 1 1 ( ) I J N N ijn M ijn i j n S d a R = = = = Σ Σ Σ where {dijn} are arbitrary regression constants that are not equal, aM is a rank score of Rijn, and Rijn is the rank of observation Xijn. If the score function φ has a bounded second derivative on (0,1), then 2 1 2 1 1 1 1 1 1 ( ( ) ) ( ) ( ) I J N I J N N N ijn ijn i j n i j n E S E S Z O N d d − = = = = = = − − Σ Σ Σ ≤ Σ Σ Σ − and 2 1 2 1 1 1 ( ) ( ) ( ) I J N N N ijn i j n E S μ O N − d = = = − ≤ Σ Σ Σ where 1 1 1 ( ( )) ( ) I J N N ijn ij i j n μ d φ H x dF x = = = = Σ Σ Σ ∫ and 1 1 1 1 ( ) ( ) ( ) ( ( )) ( ) 1 I J N ijn ab k ijn ijn ij ab a b k Z d d u x X F x H x dF x M φ = = = = − × − − ′ + Σ Σ Σ ∫ and 58 1 1 1 1 I J N ijn i j n d d M = = = = ΣΣΣ and 1 1 1 ( ) ( ) ( ) I J ij i j H x IJ F x − = = = Σ Σ Theorem 3.2: Under the conditions of Theorem 3.1, for any ε>0 there exists a constant Kε such that 2 , , var( ) max( ) N ijn i j n S K d d ε > − entails max Pr( ( ) var( ) ) ( ) N N N x S − E S < x S − Φ x < ε (3.6) where Φis the cdf of the standard normal distribution. The assertation remains true if var(SN) is replaced by 2 N σ in (3.6). Also, if 2 1 1 1 I J N i j n ijn d = = = ΣΣΣ is a bounded multiple of 2 1 1 1 ( ) I J N ijn i j n d d = = = ΣΣΣ − , the asseration remains true if E(SN) is replaced in (3.6) by N μ . Theorem 3.3: Let SN be a linear rank statistic such that the score function φ has a bounded second derivative and the constants {dijn} do not depend on n or N; that is, dijn = dij (1≤ n ≤ N, 1≤ i ≤ I , 1≤ j ≤ J ). If 2 1 lim 0 N N N σ →∞ > , then (SN – E(SN))/σN d→ N(0,1) and (SN – μN)/σN d→ N(0,1). Proof from Thompson: 2 1 lim 0 N N N σ →∞ > implies that N σ →∞ as N →∞. As shown in (5.6) of Hajek (1968), var( ) (1)max n N ijn σ − S ≤ O d − d . Since max ijn d − d does not depend on N, then both N σ →∞ and ( ) N var S →∞ as N →∞. Hence 59 2 , , var( ) max( ) i j n N ijn S K d d ε > − holds for all N sufficiently large and the desired result follows from Theorem 3.2. Theorem 4.1: If φ is a score function that is not constant a.e. with respect to a measure induced by Fi for some i, then 2 1 2 0 lim ( ) 0 d N N σ N σ j − →∞ = > and (a) ( ( ) ( ( ))) / ( ) (0,1) d N N N S j − E S j σ j →N (b) ( ( ) ( )) / ( ) (0,1) d N N N S j − μ j σ j →N and (c) 1 0 ( , ) ( ( )) ( ) p N i N S i j φ H x dF x − →∫ where the limits are taken along a sequence of Pitman alternatives. Theorem 5.3: Under the conditions of Theorem 4.1, 2 0 ( ) p N N D θ →σ . Note: 2 2 2 0 1 1 ( 1) 2 ( , ) ( 1) ( ) N i j J J N N S i j I J x dx J σ φ − − − = − ∫ ΣΣ where φ is a score function defined on (0,1) and 1 ( , ) ( ) N N M ijn n S i j a R = =Σ , with ( ) M ijn a R being defined as in Theorem 3.1 Proof from Thompson: 2 2 2 ( 1) 1 1 1 ( ) ( ) ( , ) ( 1) ( 1) M i j n i j N N ijn N I J J D a R S i j J IJ N J N N θ − − = − − − ΣΣΣ ΣΣ Theorem 4.1 implies that 1 ( , ) ( 1) N S i j N N − converges in probability to 60 ; 0 lim ( ( )) ( ) ( ( )) ( ) ( 1) N ij N i N N H x dF x H x dF x N N φ φ →∞ = − ∫ ∫ . Hence, 2 2 1 1 ( , ) ( 1) N i j J S i j J N N − − ΣΣ converges in probability to 2 0 1 1 [ ( ( )) ( )] I i i J J φ H x dF x = − Σ ∫ . Next, note that 2 ( ) M ijn i j n ΣΣΣa R is a constant and therefore invariant under the choice of hypothesis. Thus, 2 ( 1) 1 ( ) ( 1) M i j n ijn I J a R J IJ N − − ΣΣΣ converges to 2 ( 1) ( ) I J x dx J φ − ∫ and therefore, 2 0 ( ) p N N D θ →σ . 61 A.2 SAS CODE The following code was written in SAS version 9.1.3 and was used to run the simulations described in Chapter 4. A.2.1 NORMAL ERROR DISTRIBUTIONS, VARIANCE COMPONENTS COVARIANCE STRUCTURE, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions */ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1' new; run; PROC IML; Seed=0; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); 62 subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*Subject effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  VC right now, sigma2=1*/ Cov=I(3); /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create Xdata from X; append from X; Close Xdata; Create NormalData From Y; append from Y; Close NormalData; create Data1 var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1; 63 /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; edit Xdata; append from X; Close Xdata; edit NormalData; append from Y; Close NormalData; edit Data1; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1; end; Proc Printto print = '/simulations/mixedinfo' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=Tests; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=vc sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2; SET Tests; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; 64 IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3; SET Tests; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1'; run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1; SET Data1; PROC SORT DATA=DataR1; BY reps treatment subject repmeasure; Proc Rank Out=DataR1Rank; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1Rank; By reps treatment subject repmeasure; Proc Printto print = '/simulations/mixedinfo'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1Rank NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRank; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment); Repeated / type=vc sub=subject(treatment) r rcorr; 65 /*Interaction Test*/ DATA DataR2; SET TestsRank; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3; SET TestsRank; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2 R=AlignResid; Proc Printto print = '/simulations/residuals' new; run; PROC PRINT DATA=dataA2; run; Proc Printto log = '/logs/sim1'; run; PROC SORT; By reps treatment subject; 66 /*Rank residuals*/ PROC RANK OUT=DataA3; By reps; Var AlignResid; ranks ARY; Proc Printto print = '/simulations/mixedinfo'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA3; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign; Model ARY = treatmentrepmeasure / outp=predictedalign; Random subject(treatment); Repeated / type=vc sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4; SET TestsAlign; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5; SET TestsAlign; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; 67 run; /*Get Residuals from the data*/ PROC GLM DATA=Data1 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22 R=AlignResid2; Proc Printto print = '/simulations/residuals' new; run; PROC PRINT DATA=dataA22; run; Proc Printto log = '/logs/sim1'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23; By reps; Var AlignResid2; ranks ARY; Proc Printto print = '/simulations/mixedinfo'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2; Model ARY = treatmentrepmeasure / outp=predictedalign2; Random subject(treatment); Repeated / type=vc sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24; SET TestsAlign2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; 68 /*'Main Effect' Test*/ DATA DataA25; SET TestsAlign2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1'; run; Proc Printto print = '/simulations/simoutput' new; run; Proc Print Data=Data2; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; 69 Proc Print Data=DataA5; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1; SET Data1; run; quit; 70 A.2.2 NORMAL ERROR DISTRIBUTIONS, COMPOUND SYMMETRIC COVARIANCE STRUCTURE, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  CS Covariance */ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1CS' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*Subject effects*/ taus={0,0,0}; /*Matrix with nx1 subject effects*/ 71 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  Compound Symmetric  sigma^2=9, sigma1^2=4*/ /* Values of sigma chosen to get a positive definite matrix */ Cov={13 4 4, 4 13 4, 4 4 13}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); BCov=(1/13)*BCov; /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; Create XdataCS from X; append from X; Close XdataCS; Create NormalDataCS From Y; append from Y; Close NormalDataCS; create Data1CS var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1CS; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ 72 Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; edit XdataCS; append from X; Close XdataCS; edit NormalDataCS; append from Y; Close NormalDataCS; edit Data1CS; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1CS; end; Proc printto print = '/simulations/mixedinfoCS' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1CS NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsCS; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2CS; SET TestsCS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3CS; SET TestsCS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; 73 ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1CS'; run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1CS; SET Data1CS; PROC SORT DATA=DataR1CS; BY reps treatment subject repmeasure; Proc Rank Out=DataR1RankCS; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1RankCS; By reps treatment subject repmeasure; Proc printto print = '/simulations/mixedinfoCS'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1RankCS NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRankCS; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataR2CS; SET TestsRankCS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3CS; 74 SET TestsRankCS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1CS'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1CS; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1CS NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2CS R=AlignResid; Proc printto print = '/simulations/residualsCS' new; run; PROC PRINT DATA=dataA2CS; run; Proc Printto log = '/logs/sim1CS'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA3CS; By reps; Var AlignResid; ranks ARY; Proc printto print = '/simulations/mixedinfoCS'; run; 75 /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA3CS; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlignCS; Model ARY = treatmentrepmeasure / outp=predictedalign; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4CS; SET TestsAlignCS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5CS; SET TestsAlignCS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1CS'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1CS; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1CS NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22CS R=AlignResid2; Proc printto print = '/simulations/residualsCS' new; 76 run; PROC PRINT DATA=dataA22CS; run; Proc Printto log = '/logs/sim1CS'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23CS; By reps; Var AlignResid2; ranks ARY; Proc printto print = '/simulations/mixedinfoCS'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23CS; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2CS; Model ARY = treatmentrepmeasure / outp=predictedalign2; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24CS; SET TestsAlign2CS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA25CS; SET TestsAlign2CS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; 77 proc printto log = '/logs/sim1CS'; run; Proc printto print = '/simulations/simoutputCS' new; run; Proc Print Data=Data2CS; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3CS; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2CS; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3CS; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24CS; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25CS; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4CS; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; Proc Print Data=DataA5CS; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1CS; SET Data1CS; run; quit; 78 A.2.3 NORMAL ERROR DISTRIBUTIONS, AUTOREGRESSIVE COVARIANCE STRUCTURE, ρ=0.75, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  AR(1) Covariance*/ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1AR' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*rep measure effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ 79 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  AR(1)  sigma^2=1, rho = 0.75*/ Cov={1 0.75 0.5625, 0.75 1 0.75, 0.5625 0.75 1}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); BCov2=I(9)@Cov; /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create XdataAR from X; append from X; Close XdataAR; Create NormalDataAR From Y; append from Y; Close NormalDataAR; create Data1AR var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1AR; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; 80 edit XdataAR; append from X; Close XdataAR; edit NormalDataAR; append from Y; Close NormalDataAR; edit Data1AR; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1AR; end; Proc printto print = '/simulations/mixedinfoAR' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1AR NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAR; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2AR; SET TestsAR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3AR; SET TestsAR; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; 81 proc printto log = '/logs/sim1AR'; run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1AR; SET Data1AR; PROC SORT DATA=DataR1AR; BY reps treatment subject repmeasure; Proc Rank Out=DataR1RankAR; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1RankAR; By reps treatment subject repmeasure; Proc printto print = '/simulations/mixedinfoAR'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1RankAR NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRankAR; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataR2AR; SET TestsRankAR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3AR; SET TestsRankAR; 82 IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1AR'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1AR; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2AR R=AlignResid; Proc printto print = '/simulations/residualsAR' new; run; PROC PRINT DATA=dataA2AR; run; Proc Printto log = '/logs/sim1AR'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA3AR; By reps; Var AlignResid; ranks ARY; Proc printto print = '/simulations/mixedinfoAR'; run; /*Mixed analysis on Aligned data */ 83 PROC MIXED DATA=DataA3AR; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlignAR; Model ARY = treatmentrepmeasure / outp=predictedalign; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4AR; SET TestsAlignAR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5AR; SET TestsAlignAR; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1AR'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1AR; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22AR R=AlignResid2; Proc printto print = '/simulations/residualsAR' new; run; 84 PROC PRINT DATA=dataA22AR; run; Proc Printto log = '/logs/sim1AR'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23AR; By reps; Var AlignResid2; ranks ARY; Proc printto print = '/simulations/mixedinfoAR'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23AR; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2AR; Model ARY = treatmentrepmeasure / outp=predictedalign2; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24AR; SET TestsAlign2AR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA25AR; SET TestsAlign2AR; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1AR'; 85 run; Proc printto print = '/simulations/simoutputAR' new; run; Proc Print Data=Data2AR; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3AR; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2AR; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3AR; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24AR; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25AR; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4AR; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; Proc Print Data=DataA5AR; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1AR; SET Data1AR; run; quit; 86 A.2.4 NORMAL ERROR DISTRIBUTIONS, AUTOREGRESSIVE COVARIANCE STRUCTURE, ρ=0.5, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  AR2(1) Covariance*/ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1AR2' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*rep measure effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ 87 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  AR2(1)  sigma^2=1, rho = 0.75*/ Cov={1 0.5 0.25, 0.5 1 0.5, 0.25 0.5 1}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create XdataAR2 from X; append from X; Close XdataAR2; Create NormalDataAR2 From Y; append from Y; Close NormalDataAR2; create Data1AR2 var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1AR2; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; 88 edit XdataAR2; append from X; Close XdataAR2; edit NormalDataAR2; append from Y; Close NormalDataAR2; edit Data1AR2; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1AR2; end; Proc printto print = '/simulations/mixedinfoAR2' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1AR2 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAR2; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2AR2; SET TestsAR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3AR2; SET TestsAR2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1AR2'; 89 run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1AR2; SET Data1AR2; PROC SORT DATA=DataR1AR2; BY reps treatment subject repmeasure; Proc Rank Out=DataR1RankAR2; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1RankAR2; By reps treatment subject repmeasure; Proc printto print = '/simulations/mixedinfoAR2'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1RankAR2 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRankAR2; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataR2AR2; SET TestsRankAR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3AR2; SET TestsRankAR2; 90 IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1AR2'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1AR2; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR2 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2AR2 R=AlignResid; Proc printto print = '/simulations/residualsAR2' new; run; PROC PRINT DATA=dataA2AR2; run; Proc Printto log = '/logs/sim1AR2'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA3AR2; By reps; Var AlignResid; ranks AR2Y; Proc printto print = '/simulations/mixedinfoAR2'; run; 91 /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA3AR2; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlignAR2; Model AR2Y = treatmentrepmeasure / outp=predictedalign; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4AR2; SET TestsAlignAR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5AR2; SET TestsAlignAR2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1AR2'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1AR2; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR2 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22AR2 R=AlignResid2; Proc printto print = '/simulations/residualsAR2' new; 92 run; PROC PRINT DATA=dataA22AR2; run; Proc Printto log = '/logs/sim1AR2'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23AR2; By reps; Var AlignResid2; ranks AR2Y; Proc printto print = '/simulations/mixedinfoAR2'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23AR2; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2AR2; Model AR2Y = treatmentrepmeasure / outp=predictedalign2; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24AR2; SET TestsAlign2AR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA25AR2; SET TestsAlign2AR2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; 93 proc printto log = '/logs/sim1AR2'; run; Proc printto print = '/simulations/simoutputAR2' new; run; Proc Print Data=Data2AR2; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3AR2; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2AR2; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3AR2; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24AR2; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25AR2; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4AR2; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; Proc Print Data=DataA5AR2; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1AR2; SET Data1AR2; run; quit; 94 A.2.5 NORMAL ERROR DISTRIBUTIONS, AUTOREGRESSIVE COVARIANCE STRUCTURE, ρ=0.25, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  AR3(1) Covariance*/ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1AR3' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*rep measure effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ 95 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  AR3(1)  sigma^2=1, rho = 0.75*/ Cov={1 0.25 0.0625, 0.25 1 0.25, 0.0625 0.25 1}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create XdataAR3 from X; append from X; Close XdataAR3; Create NormalDataAR3 From Y; append from Y; Close NormalDataAR3; create Data1AR3 var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1AR3; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; 96 edit XdataAR3; append from X; Close XdataAR3; edit NormalDataAR3; append from Y; Close NormalDataAR3; edit Data1AR3; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1AR3; end; Proc printto print = '/simulations/mixedinfoAR3' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1AR3 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAR3; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2AR3; SET TestsAR3; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main
Click tabs to swap between content that is broken into logical sections.
Rating  
Title  Rank Transforms and Tests of Interaction for Repeated Measures Experiments with Various Covariance Structures 
Date  20090501 
Author  Bryan, Jennifer 
Keywords  Covariance Structure, Rank Transforms, Repeated Measures 
Department  Statistics 
Document Type  
Full Text Type  Open Access 
Abstract  The covariance structure of a repeated measures design can be simple or very complicated. In analyzing repeated measures, rank transformations can be an alternative to the standard tests performed on the raw data. An alternative to utilizing the common rank transform when testing for interaction is the aligned rank procedure in which the estimate for the interaction effect is adjusted for the observed main effects. The question arises as to how the covariance structure may affect the aligned rank transform procedure when analyzing repeated measures, specifically the test of interaction. The objectives of this paper are 1) to find how the alignment for the aligned rank transform affects the repeated measures model, 2) to find the variance of the aligned observations, 3) to find the asymptotic distribution of the aligned rank transform test in a factorial setting, and 4) compare the standard F test, rank transform test, and two approaches to the aligned rank transform test (the na�ve approach or ART1 and the standard approach or ART2) in analyzing a repeated measures design with the use of Monte Carlo simulations. Five initial conditions will be considered: no main effects or interactions, only treatment main effects, only repeated measures main effects, both treatment and repeated measures main effects and only interactions. In addition to the initial conditions, five covariance structures will be simulated: variance components, compound symmetric and three types of firstorder autoregressive. 
Note  Dissertation 
Rights  © Oklahoma Agricultural and Mechanical Board of Regents 
Transcript  RANK TRANSFORMS AND TESTS OF INTERACTION FOR REPEATED MEASURES EXPERIMENTS WITH VARIOUS COVARIANCE STRUCTURES By JENNIFER JOANNE BRYAN Bachelor of Science Oklahoma Christian University Edmond, OK 1996 Master of Science Oklahoma State University Stillwater, OK 2000 Submitted to the Faculty of the Graduate College of the Oklahoma State University in partial fulfillment of the requirements for the Degree of DOCTOR OF PHILOSOPHY May, 2009 ii RANK TRANSFORMS AND TESTS OF INTERACTION FOR REPEATED MEASURES EXPERIMENTS WITH VARIOUS COVARIANCE STRUCTURES Dissertation Approved: Dr. Mark Payton Dissertation Adviser Dr. P. Larry Claypool Dr. Melinda McCann Dr. Lisa Mantini Dr. A. Gordon Emslie Dean of the Graduate College iii ACKNOWLEDGEMENTS I would like to express my sincere gratitude to Dr. Mark Payton for his support, encouragement, and advice, without which I would not have been able to complete this dissertation. I would also like to thank the other members of my committee, Dr. P. Larry Claybool, Dr. Melinda McCann, and Dr. Lisa Mantini, for reviewing my work and providing invaluable guidance. Finally, I would like to extend my gratitude to the entire Department of Statistics at Oklahoma State University. I would also like to thank my family and friends for their support. I am especially thankful to my parents, Philip and JaReesa, and my nephews, Blake and Bryce for their encouragement and loving support throughout this process. iv TABLE OF CONTENTS Chapter Page I. INTRODUCTION ......................................................................................................1 II. BACKGROUND AND LITERATURE REVIEW Sphericity .................................................................................................................4 Normality .................................................................................................................7 Nonparametric Methods...........................................................................................8 Rank Transformations ..............................................................................................9 Aligned Rank Transformation ...............................................................................11 III. LINEAR MODEL AND ASYMPTOTIC DISTRIBUTION FOR ALIGNED RANKS Linear Model ..........................................................................................................14 Alignment ..............................................................................................................15 Asymptotic Distribution.........................................................................................20 IV. SIMULATIONS ....................................................................................................38 V. CONCLUSION ......................................................................................................50 REFERENCES ............................................................................................................53 APPENDICES .............................................................................................................56 v LIST OF TABLES Table Page Compound Symmetric Covariance Structure ..........................................................32 Variance Components Covariance Structure ............................................................45 Compound Symmetric Covariance Structure ...........................................................46 Autoregressive Covariance Structure, ρ=0.75 ..........................................................47 Autoregressive Covariance Structure, ρ=0.5 ............................................................48 Autoregressive Covariance Structure, ρ=0.25 ..........................................................49 1 CHAPTER I INTRODUCTION Repeated measures situations occur when, for a group of subjects, a response is measured repeatedly under different circumstances. The repeated measure factor is usually time and is called the within subject factor. If subjects are divided into groups according to another factor, such as treatment, this is called the between subject factor. Each subject is observed at only one level of a between subject factor. When testing for main and interaction effects in a repeated measures design, traditional univariate Ftests are typically not valid under violations of normality or under violations of homogeneous covariance structures. When the data violates normality, two options have emerged, either transform the data into a form that more closely resembles the normal distribution or use a distribution free procedure. One of the first to discuss transformations was Bartlett (1936, 1947) who proposed a square root transformation and a logarithmic transformation. Rank transformations were popularized by Conover and Iman (1981) as an alternative way to analyze the data that combines these two options. When analyzing repeated measures data, since the response variable is measured repeatedly, the covariance structure is typically nonhomogeneous. The covariance structure of a repeated measures design can be simple, as in the variance components design where all variances are equal and all covariances zero, or very complicated, as in the unstructured design where all variances are unequal and all covariances are different. In analyzing repeated measures, rank transformations can be an 2 alternative to the standard tests performed on the raw data. Rank transformations were initially proposed as an alternative when dealing with data that violated normality or homogeneity of variances. An alternative to utilizing the common rank transform is the aligned rank procedure. The aligned rank transform minimizes the effect of violations of assumptions such as normality and homogeneous covariance matrices, but does not suffer some of the same problems of the rank transform, such as introducing interactions when they are not present or removing interactions when they are present. The question arises as to how the covariance structure may affect the aligned rank transform procedure when analyzing repeated measures. Three specific covariance structures will be investigated, variance components (VC), compound symmetry (CS) and firstorder autoregressive (AR(1)). In a variance components covariance structure, all variances are assumed to be equal and all covariances are 0. A 3×3 example of the variance components structure would be: 2 1 2 1 2 1 0 0 0 0 0 0 σ σ σ . In a compound symmetric covariance structure, the variances are again assumed to be equal as are all the covariances. The variances of the compound symmetric covariance structure are composed of the addition of two variance pieces, σ2 and σ1 2. One of these pieces is then used for all the covariances, σ1 2. A 3×3 example of this covariance structure would be: 2 2 2 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 1 1 1 σ σ σ σ σ σ σ σ σ σ σ σ + + + . 3 Finally, a firstorder autoregressive covariance structure has a multiplicative piece for all offdiagonal entries called ρ which is the correlation between adjacent observations on the same subject. If the entry is adjacent to the diagonal, then the covariance is found by multiplying the variance by ρ. If the entry is two spaces away from the diagonal, then the covariance is found by multiplying the variance by ρ2. For an entry that is three spaces away from the diagonal, the covariance is found by multiplying the variance by ρ3. For an entry that is four spaces away from the diagonal, multiply the variance by ρ4, and so on. A 3×3 example of this covariance structure would be: 2 2 2 1 1 1 ρ ρ σ ρ ρ ρ ρ . This paper will investigate the rank transform test and two approaches to the aligned rank transform test in analyzing data from a repeated measures design. Error distributions that are normal and nonnormal will be investigated as will covariance structures with and without homogeneity of variances. The objectives of this paper are 1) to find how the alignment for the aligned rank transform affects the repeated measures model, 2) to find the variance of the aligned observations, 3) to find the asymptotic distribution of the aligned rank transform test in a factorial setting, and 4) compare the standard test, rank transform test, and two approaches to the aligned rank transform test in analyzing a repeated measures design with the use of Monte Carlo simulations. 4 CHAPTER II BACKGROUND AND LITERATURE REVIEW As was stated previously, repeated measures situations occur when, for a group of subjects, a response is measured repeatedly under different circumstances. When testing for main and interaction effects in a repeated measures design, traditional univariate Ftests are typically not valid under violations of normality or under violations of homogeneous covariance structures. Homogeneity of variances is an assumption that the variances of the groups being tested are equal. This can further be exacerbated when group sizes are unequal. Typically, with such violations, Type I error rates can be inflated (Keselman et al., 1996). The data also violate the assumption of independence since there is typically correlation among the repeated measures observations. Sphericity Sphericity, also referred to as the HuynhFeldt condition, is an assumption concerning the structure of the covariance matrix and is often compared to the assumption of homogeneity of variance for ANOVA. Sphericity occurs when the variance of the difference between the estimated means for any pair of groups or treatments is the same as for any other pair. If a covariance matrix satisfies this condition, it is referred to as a Type H matrix. One way to test for sphericity is to see if the covariance matrix is compound symmetric. If the matrix is compound symmetric, all 5 covariances for measurements within the same subject are equal and all variances are equal. While compound symmetry has been shown to be a sufficient condition for using the traditional analysis of variance (ANOVA) on repeated measures data, it is not a necessary condition. Compound symmetry is a more restrictive form of sphericity. For a repeated measures factor with only two levels, the sphericity assumption is always met since there is, in effect, only one covariance. For a repeated measures factor with three or more levels, a test for sphericity must be done. For betweengroup ANOVA, there is an assumption of independence of the groups. However, repeated measures can introduce covariation between these groups, and so a test for sphericity must be conducted. If the variances of the differences between repeated measures levels are not equal, one must determine the significance of the violation of sphericity. One way to test the severity of the departure is to use Mauchley’s test, which tests the hypothesis that the variances of the differences between repeated measures levels are equal (Mauchly, 1940). If Mauchley’s test is significant, we conclude that there are significant differences among the variances of differences between repeated measures levels and sphericity is not met. While Mauchley’s test can be useful for determining the violation of the condition of sphericity, it can have low power for experiments with small samples. The ability to detect departures from the null hypothesis that the covariance matrix satisfies the Huynh Feldt condition is not very good unless the experiments have a large number of replications (Kuehl, 2000). If sphericity is violated, there are two approaches one can take in order to remedy the violation. One approach is to use a test that does not assume sphericity is present, such as the multivariate analysis of variance or MANOVA. However, in general, 6 MANOVA is a less powerful test than repeated measures ANOVA and should probably not be used (Baguley, 2004). Baguley suggests that if the sample sizes are large, greater than the sum of 10 and the number of repeated measures, and if ε is less than 0.7, where ε is the degree to which sphericity has been violated, then MANOVA may be more powerful and could be a preferred test. Further discussion of ε with three common ways to measure it will be discussed next. The other approach is to use a correction to the degrees of freedom for the standard ANOVA tests. Three such corrections are the GeisserGreenhouse Ftest, the GreenhouseGeisser correction (Greenhouse and Geisser, 1959) and the HuynhFeldt correction (Huynh and Feldt, 1976). In the Geisser Greenhouse Ftest, the numerator degrees of freedom are set to 1 and the denominator degrees of freedom are set to n (the total number of subjects). This is a very conservative approach. The other two corrections adjust the degrees of freedom in the standard ANOVA test to produce a more accurate observed significance value. The Greenhouse Geisser correction, usually denoted as εˆ , varies between 1 K −1 and 1, where K is the number of repeated measures. The closer εˆ is to 1, the more homogeneous the variances of the differences and hence the closer the data are to being spherical. Both the numerator and denominator degrees of freedom are multiplied by 2 2 [ ( ' )] ˆ ( 1) [( ' )] tr C SC K tr C SC ε = − , where S is the pooled sample covariance matrix, C is a normalized matrix of K1 orthogonal contrasts. The assumption of sphericity is satisfied if and only if the K1 contrasts are independent and equally variable. (Keselman et al., 2001). When repeated measures designs have a betweensubject grouping variable, the covariance matrices of the 7 treatment differences must be the same or homogeneous for all levels of the grouping factor. This is referred to as multisample sphericity. (Keselman, et al., 2001). Huynh and Feldt (1976) reported that when εˆ > 0.75, the test is too conservative and Collier, et al. (1967) showed that this can be true with εˆ as high as 0.90. Huynh and Feldt (1976) proposed a correction to εˆ , denoted ε%, to make it less conservative. As in the GreenhouseGeisser correction, both the numerator and denominator degrees of freedom are multiplied by ( 1)( 1) ˆ 2 ( 1)[ ( 1) ˆ] N J K K N J K ε ε ε − + − − = − − − − % , where N is the total number of subjects, J is the number of treatments or betweensubject factors, and K is the number of levels of the repeated measures or withinsubject factors (Keselman, et al., 2001). However, Maxwell and Delaney (1990) report that ε%actually overestimates sphericity. Stevens (1992) recommends taking an average of both the HuynhFeldt and Greenhouse Geisser measures and adjusting the degrees of freedom by this averaged value. Girden (1992) recommends that when εˆ > 0.75, the degrees of freedom should be corrected using ε%. If εˆ < 0.75 or if nothing is known about sphericity at all, then the conservative εˆ should be used to adjust the degrees of freedom. Normality Normality is an assumption that the data come from a normal distribution. If the normality assumption is violated, one solution is to transform the data prior to the analysis. Common transformations include logarithms or the square root function. Another solution is to use a procedure that is distribution free. This solution often involves methods that are based on the ranks of the data. If the assumption of normality is violated, one of the most frequently recommended alternatives is the nonparametric 8 Friedman rank test (Harwell and Serlin, 1994). The rank transformation procedure, proposed by Conover and Iman (1981), combines these by replacing the data with ranks and then applying parametric tests to the ranks, and is discussed in more detail in this chapter. Nonparametric tests Nonparametric tests are based on some of the same assumptions on which parametric tests are based, but they do not assume a particular population probability distribution and thus are valid for data from any population. Wilcox (1998) notes that even arbitrarily small departures from normality can result in lower power for the parametric methods versus the nonparametric methods. Many nonparametric tests apply some kind of rank transformation to the data, such as replacing the data with their ranks, and then use the usual parametric procedure on the ranks instead of the data. The Wilcoxon Signed Rank test is used to test whether a particular sample came from a population with a specified mean or median. Differences between bivariate data (or in one sample, the individual observations) are ranked from 1 to n and the resulting test statistic has an approximate standard normal distribution. The MannWhitney test, which is also called the Wilcoxon Rank Sum test, takes two independent samples from two populations and tests if the populations have equal means. Observations are ranked from 1 to N, the sum of the two sample sizes. The test statistic is then conducted using the ranks. If there are no ties and N ≤ 50 , lower quantiles of the exact distribution of the test statistic can be found in tables (Conover, 353). If there are a large number of ties in the ranks, the test statistic is an approximately standard normal distribution. The Kruskal 9 Wallis test extends the MannWhitney test, to k independent samples from k populations. While the exact distribution of the KruskalWallis can be found, it is often difficult to work with and therefore an approximate chisquared distribution with k1 degrees of freedom is used when conducting hypothesis tests. The Friedman rank test uses observations from b mutually independent kvariate random variables from a randomized complete block design, where b is the number of blocks. Ranks are assigned to observations separately within each block with ranks ranging from 1 to k. The exact distribution of the test statistic is difficult to find and so an approximate chisquared distribution with k1 degrees of freedom is used. However, this approximation may sometimes be poor and thus a second test statistic is used that has an approximate Fdistribution with k1 and (b1)(k1) degrees of freedom. The Quade test extends Friedman’s test by taking the range for the observations in each block and then ranking the ranges. The block rank is then multiplied by the difference between the rank of the observation in each block and the average rank within blocks. The distribution of the resulting test statistic is again difficult to find, but it can be approximated by an Fdistribution with k1 and (b1)(k1) degrees of freedom, just like the Friedman test. Rank Transformations Rank transformation procedures were proposed as an alternative when dealing with violations of normality and sphericity. One such transformation was to rank all the observations without regard to group or measure and use these ranked scores instead of the original data when using the typical analysis of variance (Conover and Iman, 1981). Two reasons for the popularity of the rank transformation statistic are that it is relatively 10 simple and it is accessible in most statistical packages since the traditional Fstatistic is calculated based on the rank transformation of the original observations. For single sample repeated measures designs, the ANOVA Ftest was robust to violations of normality when performed on ranks (Zimmerman and Zumbo, 1993) and to violations of sphericity (Agresti and Pendergast, 1986). However, the rank transformation procedure may have problems in factorial experiments. While theoretical results suggest that the rank transformation procedure provides asymptotically valid tests for analyzing experiments when additive effects are present (Iman, et al., 1984), a problem may occur if interactions are present. The rank transformation procedure may introduce interactions that were not present in the original data or it may remove interactions that were present in the original data (Higgins and Tashtoush, 1994). Akritas (1990) showed that the rank transform procedure is not valid for most of the common hypotheses in twoway crossclassifications and nested classifications primarily because of the nonlinear nature of the rank transform. Akritas (1991) also showed that the rank transform procedure can destroy the equicorrelation between error terms and/or the assumption of equal covariance matrices, which renders the rank transform procedure invalid for most situations. Akritas (1991) notes that the rank transform procedure for repeated measure designs with general covariance matrices could be used in some cases where the equicorrelation assumption is destroyed. Higgins and Tashtoush (1994) suggest that there is no justification for generally applying the rank transform procedure in factorial experiments with interaction, but there may be special cases where it is appropriate. 11 Also, there have been conflicting simulation studies concerning the performance of the rank transform for interactions in a twoway layout. Iman (1974) and Conover and Iman (1976) showed that the rank transform statistic performed well in detecting interactions when there were small sample sizes and small main effects. Iman (1974) studied a factorial design and Conover and Iman (1976) studied a 4×3 factorial design with 5 replications. In both studies, it was concluded that the rank transform statistic was powerful and robust. However, simulations by Blair, et al. (1987) showed that the Type I error rates in the tests for interaction effects were unacceptably large if either the main effects or the sample sizes are large. They also showed that the interaction and main effect relationships were not expected to be maintained after the rank transformation was applied. Thompson (1991) suggested the need to study the asymptotic properties of the rank transform procedure for interactions. Thompson showed that, for a balanced twoway classification, the limiting distribution of the rank transform statistic multiplied by its degrees of freedom was a χ2distribution if and only if either there is only one main effect or if there are exactly two levels of both main effects. If this is not the case, there exist values for the main effects where the expected value of the test statistic under the null hypothesis approaches infinity as the sample size increases. Thus, the rank transform procedure becomes liberal with type I error rates even for large sample sizes. Aligned Rank Transformation Aligned rank transformation procedures were popularized by Higgins and Tashtoush (1994) as a way to ‘correct’ the rank transform. They suggest aligning the data first by removing the effect of any ‘nuisance’ parameters and then ranking the aligned 12 data. To align the data for a repeated measures design, one would subtract two parameters, the repeated measures main effect and the subject effect and then add in the overall mean. Mathematically, for a repeated measures design, the aligned data would be, ijk ijk ij. ..k ... AB = Y −Y −Y +Y (1) where ij. Y is the mean for the jth subject, given the ith treatment, and averaged across the repeated measures, ..k Y is the marginal mean for the kth repeated measure over all subjects and treatments, and ... Y is the grand mean. Higgins and Tashtoush also note that another alignment could be used for repeated measures and call this the naïve alignment. This alignment is the same as the alignment for the twoway completely random design. Data used under this alignment would be, .. . . .. ... 2* ijk ijk i j k AB = Y −Y −Y −Y + Y (2) where i.. Y is the marginal mean for the ith treatment over all subjects and repeated measures, . j. Y is the marginal mean for the jth subject over all treatments and repeated measures, ..k Y is the marginal mean for the kth repeated measure over all subjects and treatments, and ... Y is the grand mean. After either alignment, the transformed data are then ranked as in the rank transform procedure. Hettmansperger (1984) also suggests that this alignment could be accomplished by obtaining residuals from a linear model by regressing the original data on a set of dummy codes that represent the subject effect and a set of contrast codes that represent the repeated measures main effect. Since the aligned rank transform test is based on the Fdistribution, it is not distribution free. Higgins and Tashtoush (1994) concluded that it appeared to be a robust procedure with respect to the error distribution and critical values can be adequately 13 approximated by those of the Fdistribution. They also say that the test “has many of the desirable power properties of the common nonparametric tests. Moreover, the tests do not have the same potential for giving misleading results as the ordinary rank transform tests when applied to multifactor experiments with interaction.” Beasley (2000) notes that test statistics for the rank transform procedure maintain the expected Type I error rate when a slight repeated measure main effect was present. However, by not removing the repeated measure main effect through alignment, tests for interaction may demonstrate lower power when a strong repeated measures main effect is present. However, many properties of the original data transmit to ranks including heterogeneity of variance (Zimmerman and Zumbo, 1993) and nonsphericity (Harwell and Serlin, 1994). Thus, corrections to the degrees of freedom can be performed if the covariance matrix is nonspherical or heterogeneous. Mansouri and Chang (1995) showed that for most light or heavytailed distributions, such as the uniform, exponential, double exponential and lognormal, the aligned rank transform was a more robust test statistic than the rank transform and was a powerful test. They also showed that the classical Ftest had a severe loss of power for asymmetric or heavytailed distributions. However, for a Cauchy distribution, the rank transform performed considerably better than the aligned rank transform since the Type I error rate was less inflated. Similarly, Higgins and Tashtoush (1994) showed that for lighttailed, symmetric distributions, the classical Ftest had a slight power advantage over the aligned rank transform with results generally less than 0.10. However, for heavytailed distributions or skewed distributions, the aligned rank transform was superior and that the power advantages could be substantial, with results often in the 0.15 to 0.30 range. 14 CHAPTER III LINEAR MODEL AND ASYMPTOTIC DISTRIBUTION FOR ALIGNED RANKS To perform the alignment on our repeated measures design for the aligned rank transform, the linear model must be defined. The linear model for a repeated measures design is the following: ( Yijk = μ +αi + d j i) +βk + (αβ )ik + eijk (3) where: i = treatment levels (1 to t) j = subjects (1 to s) k = repeated measures (1 to r) μ = overall mean i α = treatment i effect (whole plot effect) j (i) d = random effect of subject j in treatment i (whole plot error) k β = repeated measure k effect (subplot effect) ik αβ = treatment i by repeated measure k interaction ijk e = random error (subplot error) Transforming this into matrix notation, we have: Y = Xβ + Zu + e (4) where: X = tsr * (1 + t + r + tr) design matrix consisting of 0’s and 1’s β = (1 + t + r + tr) * 1 matrix of fixed effects consisting of μ , i α , k β , ik αβ Z = tsr * st design matrix consisting of 0’s and 1’s u = st * 1 matrix of random effects, u ~ MVN(0, G) consisting of j (i) d e = tsr * 1 matrix of random errors, e ~ MVN(0, R) consisting of ijk e R = block diagonal matrix with diagonal elements Σ Σ = covariance matrix for the repeated measures effects 15 Alignment Using the above matrix definition of Y in equation (4) we know that E(Y) = X β and Var(Y) = ZGZ' + R. In a repeated measures design, both design matrices, X and Z, can be written as partitioned matrices that can be defined using Kroenecker products. In this case, X = [    ] t s r t s r t s r t s r 1 ⊗1 ⊗1 I ⊗1 ⊗1 1 ⊗1 ⊗I I ⊗1 ⊗I and Z = [ ] t s r I ⊗I ⊗1 . We can also define each piece of the alignment in equation (1) using matrices: ijk = i ⊗ j ⊗ k * Y I I I Y , 1 * k = ⊗ ⊗ ij. i j k Y I I J Y , 1 1 * i j = ⊗ ⊗ ..k i j k Y J J I Y , and 1 1 1 * i j k = ⊗ ⊗ ... i j k Y J J J Y . Assuming i = 1, … ,t, j = 1, … , s and k = 1, … , r, we see the following for the alignment from equation (1): ijk ij. ..k ... Y −Y −Y +Y [ ] 1 1 1 1 1 1 * * * r t s t s r = ⊗ ⊗ − ⊗ ⊗ − ⊗ ⊗ + ⊗ ⊗ t s r t s r t s r t s r I I I *Y I I J Y J J I Y J J J Y 1 1 1 1 (  ) * (  ) * r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J Y J J I J Y (5) Substituting in our matrix definition of Y from equation (4), we can write the following: Alignment(Y) 1 1 1 1 (  ) *( ) (  ) *( ) r t s r = ⊗ ⊗ + + − ⊗ ⊗ + + t s r r t s r r I I I J Xβ Zu e J J I J Xβ Zu e 16 Theorem 1: For a repeated measures design, Y = Xβ + Zu + e , with t levels of treatment, s subjects per treatment, and r repeated measurements per subject, the alignment for Y is, Alignment(Y) = X* * β + 0 + e* = X* * β + e* where tsr x (1+t+r+tr ) X* 1 1    (  ) (  ) t r = ⊗ ⊗ tsr x 1 tsr x t tsr x r t t s r r 0 0 0 I J 1 I J and * tsr x 1 e 1 1 1 1 (  ) * (  ) * r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J e J J I J e Proof: Looking at each piece of Y separately, we find: Alignment(Xβ) 1 1 1 1 (  ) *( ) (  ) *( ) r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J Xβ J J I J Xβ [ ] 1 (  ) *    * r = ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r r t s r t s r t s r t s r I I I J 1 1 1 I 1 1 1 1 I I 1 I β [ ] 1 1 1 (  ) *    * t s r − ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r r t s r t s r t s r t s r J J I J 1 1 1 I 1 1 1 1 I I 1 I β 1 1   (  )  (  ) * r r = ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r t s r t s r r t s r r 1 1 0 I 1 0 1 1 I J I 1 I J β 1 1 1 1   (  )  (  ) * t r t r − ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ ⊗ t s r t s r t s r r t s r r 1 1 0 J 1 0 1 1 I J J 1 I J β 1 1    (  ) (  ) * t r = ⊗ ⊗ tsr x 1 tsr x t tsr x r t t s r r 0 0 0 I J 1 I J β = X* * β (6) Alignment(Zu) 1 1 1 1 (  ) *( ) (  ) *( ) r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J Zu J J I J Zu 17 [ ] [ ] 1 1 1 1 (  ) * * (  ) * * r t s r = ⊗ ⊗ ⊗ ⊗ − ⊗ ⊗ ⊗ ⊗ t s r r t s r t s r r t s r I I I J I I 1 u J J I J I I 1 u [ ] 1 1 * * t s = ⊗ ⊗ − ⊗ ⊗ t s r t s r I I 0 u J J 0 u= [ ]* = tsr x ts tsr x 1 0 u 0 (7) Alignment(e) 1 1 1 1 (  ) * (  ) * r t s r = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J e J J I J e = e* (8) Thus, Alignment(Y) = X* * β + 0 + e* = X* * β + e* . This completes the proof. Previously, we defined Var(Y) as ZGZ’ + R. This can also be defined using matrices as, Var(Y) = t ⊗ s ⊗(σ 2 r + ) I I J Σ , where σ2 is the variance of the dj(i) terms and Σ appears as a block diagonal element of R. Remember that Σ is the covariance matrix for the repeated measures effects. Calculating the variance of Y after alignment, we see that: Theorem 2: For a repeated measures design, Y = Xβ + Zu + e , with t levels of treatment, s subjects per treatment, and r repeated measurements per subject, the variance of the alignment of Y is, Var(Alignment(Y)) 1 1 1 1 1 1 (  )* *(  ) (  )* *(  ) r r t s r r = ⊗ ⊗ − ⊗ ⊗ t s r r r r t s r r r r I I I J Σ I J J J I J Σ I J . (9) Proof: Recall that when performing a linear transformation on a random vector Y, such as multiplying the vector by a matrix like we did for the alignment, the variance is then premultiplied by that same matrix and post multiplied by the transpose of that matrix. 18 For our alignment, since our alignment matrix is symmetric, we will pre and post multiply the variance matrix, t ⊗ s ⊗(σ 2 r + ) I I J Σ , by 1 1 1 1 (  ) (  ) r t s r ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J J J I J which was previously defined in equation (5). So, Var(Alignment(Y)) 2 1 1 (  ) * ( ) * (  ) r r = ⊗ ⊗ ⊗ ⊗ σ + ⊗ ⊗ t s r r t s r t s r r I I I J I I J Σ I I I J 1 1 1 2 1 1 1 (  ) * ( ) * (  ) t s r t s r − ⊗ ⊗ ⊗ ⊗ σ + ⊗ ⊗ t s r r t s r t s r r J J I J I I J Σ J J I J 2 1 1 (  )*( ) * (  ) r r = ⊗ ⊗ σ + ⊗ ⊗ t s r r r t s r r I I I J J Σ I I I J 1 1 1 2 1 1 1 (  )*( ) * (  ) t s r t s r − ⊗ ⊗ σ + ⊗ ⊗ t s r r r t s r r J J I J J Σ J J I J 1 1 (  )*( ) * (  ) r r = ⊗ ⊗ + ⊗ ⊗ t s r r t s r r I I I J 0 Σ I I I J 1 1 1 1 1 1 (  )*( ) * (  ) t s r t s r − ⊗ ⊗ + ⊗ ⊗ t s r r t s r r J J I J 0 Σ J J I J 1 1 1 1 1 1 (  )* *(  ) (  )* *(  ) r r t s r r = ⊗ ⊗ − ⊗ ⊗ t s r r r r t s r r r r I I I J Σ I J J J I J Σ I J . This completes the proof. This alignment can simplify under specific covariance structures. For example, if the covariance structure is that of variance components, then 2 t σ = Σ Ir . Substituting this into our previous alignment, we find, Var(Alignment(Y)) 2 2 1 1 1 1 1 1 ( )* *( ) ( )* *( ) t t r r t s r r = ⊗ ⊗ σ − ⊗ ⊗ σ t s r r r r r t s r r r r r I I I  J I I  J J J I  J I I  J 19 2 2 1 1 1 1 ( ) ( ) t t r t s r =σ ⊗ ⊗ −σ ⊗ ⊗ t s r r t s r r I I I  J J J I  J 2 1 1 1 1 (  ) (  ) t r t s r σ = ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J J J I J . (10) If the covariance is compound symmetric, then 2 ( (1 ) ) t σ = ρ + −ρ Σ Jr Ir and Var(Alignment(Y)) 2 [ ] 1 1 (  )* (1 ) *(  ) t r r = ⊗ ⊗ σ ρ + −ρ t s r r r r r r I I I J J I I J 1 1 1 2 [ ] 1 (  )* (1 ) *(  ) t t s r r − ⊗ ⊗ σ ρ + −ρ t s r r r r r r J J I J J I I J 2 [ ] 1 1 (  )* *(  ) t r r =σ ρ ⊗ ⊗ t s r r r r r I I I J J I J 2 [ ] 1 1 (1 ) (  )* *(  ) t r r +σ −ρ ⊗ ⊗ t s r r r r r I I I J I I J 2 [ ] 1 1 1 1 (  )* *(  ) t t s r r −σ ρ ⊗ ⊗ t s r r r r r J J I J J I J 2 1 1 1 [ ] 1 (1 ) (  )* *(  ) t t s r r −σ −ρ ⊗ ⊗ t s r r r r r J J I J I I J 2 [ ] 2 2 1 1 1 (1 ) (  ) t t t r t s =σ ρ ⊗ ⊗ +σ −ρ ⊗ ⊗ −σ ρ ⊗ ⊗ t s r t s r r t s r I I 0 I I I J J J 0 2 1 1 1 (1 ) (  ) t t s r −σ −ρ ⊗ ⊗ t s r r J J I J 2 2 1 1 1 1 (1 ) (  ) (1 ) (  ) t t r t s r =σ −ρ ⊗ ⊗ −σ −ρ ⊗ ⊗ t s r r t s r r I I I J J J I J 2 1 1 1 1 (1 ) (  ) (  ) t r t s r σ ρ = − ⊗ ⊗ − ⊗ ⊗ t s r r t s r r I I I J J J I J . (11) 20 Unfortunately, it can be difficult to write the covariance as a Kroenecker product for more complicated covariance structures and thus a convenient formula for the alignment cannot be found using Kroenecker products. For such covariance structures, Σ, we simply use the general form of the alignment from equation (9) which was: Var(Alignment(Y)) 1 1 1 1 1 1 (  )* *(  ) (  )* *(  ) r r t s r r = ⊗ ⊗ − ⊗ ⊗ t s r r r r t s r r r r I I I J Σ I J J J I J Σ I J . Now we will look at the asymptotic distribution of the aligned rank transform statistic. First, we will look at the asymptotic properties of the rank transform statistic. Thompson (1991) studied the asymptotic properties of the rank transform statistic for interactions in a balanced twoway classification. In order to attain an appreciation for Thompson’s work, it will be covered with considerable detail in this chapter. Asymptotic Distribution Thompson, in a 1991 article from Biometrika, defines the model for the twoway layout with interaction as ( ) ijn i j ij ijn X = θ + α + β + αβ + ε (12) where: i = main effect 1 levels (1 to I) j = main effect 2 levels (1 to J) n = replication (1 to N) θ = overall mean i α = main effect i j β = main effect j ij αβ = main effect i by main effect j interaction ijn ε = random error 21 Thompson also defines Fij ( x) = F ( x −θ −α i − β j ) as the distribution function of Xijn under the null hypothesis of no interaction effect and 1 ( ) ( ) ij i j H x F x IJ = ΣΣ as the average distribution function. For a fixed value i ' of i and a fixed value j ' of j, define ' ' ' ' ( ) i j i j H X = H . For the rank transform statistic, let Rijn denote the rank of Xijn among all IJN observations and let the Wilcoxon score be aijn = Rijn/(IJN + 1). Thompson defines 2 1 1 . . . . . . . . 1 J I 1 1 1 j i i j i j Q a a a a N = = J I I J = − − + Σ Σ , 2 1 1 1 . 1 N J I 1 n j i ijn ij D a a IJN IJ = = = N = − − Σ Σ Σ , and states that the statistic ( 1) Q T I J I J D = − − + is the classical normal theory test for interaction with the Wilcoxon scored ranks, aijn, substituted in place of the observations. Notice that for T to eventually be a χ2 distribution, the terms being summed in Q must be independent. Thompson set out to determine when the asymptotic distribution of T, under the null hypothesis, would not be 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + . To do this, Thompson stated and proved two lemmas. We will also need to define some terms. Let ( ) ij ij μ = N × E H , 11. . ( ,..., ) IJ a = a a ′ , 11. . ( ,..., ) IJ μ = μ μ ′ and let Γ be an IJ × IJ matrix whose rows and columns are indexed by the ordered pairs (i, j) and (r, s) where i, r = 1, 2, …, I and j, s = 1, 2, …, J. The (i, j) and (r, s)th element of Γ is 22 1 1 1 1 1 1 c o v ( ), ( ) J I J I v u v u i j ij u v r s r s u v H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Also let 2 ( i , j ) γ be the (i, j)th diagonal element of Γ. Since 0 < var(Hij) < ∞, then 0 < ( i , j ),( r ,s ) γ < ∞. Lemma 1 (Thompson): Under the null hypothesis, 1 N 2 ( ) − a − μ converges in distribution to (0, ) IJ N Γ ; in particular, 1 2 . ( , ) ( ) ij ij i j N a μ γ − − converges in distribution to N (0,1) . We are only concerned with the univariate case and Thompson notes that the univariate result for the proof follows by applying Theorem 3.3 (See Appendix A) from Thompson and Ammann (1989) to the linear rank statistic aij. with Wilcoxon scores and then simplifying the expression for the variance. Lemma 2 (Thompson): Under the null hypothesis, D converges in probability to the nonnegative, finite constant { }2 2 1 1 1 ( ) var( ) 3 ij ij E H H IJ IJ σ = − Σ Σ = Σ Σ Thompson notes that the proof is almost identical to the proof of Theorem 5.3 of Thompson and Ammann (1989). See Appendix A for a restatement of this theorem. Thompson then noted that, under the null hypothesis of no interactions, T converges in distribution to 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + by Lemma 1 and Lemma 2. From this statement, it is assumed that Thompson is inferring that the normalbased Analysis of Variance methodology holds with ij. a serving as the response variable and Q serving as a Treatment Sum of Squares. 23 Thompson then stated and proved the following Theorem: Theorem 3 (Thompson): Under the null hypothesis of no interaction as N → ∞ , lim E(T) is finite if and only if (i) E(Hij −Haj )does not depend on j for all 1 ≤ i, a ≤ I and 1 ≤ j ≤ J (ii) ( ) ij ib E H −H does not depend on i for all 1 ≤ i ≤ I and 1 ≤ j,b ≤ J Partial Proof from Thompson: Since Thompson is using an analog to ANOVA for the test statistic T, we know that D and Q are independent. It follows from Lemma 2 and Slutsky’s theorem that lim ( ) N E T →∞ is finite if and only if lim ( ) N E Q →∞ is finite. Define an IJ × IJ matrix A as having elements 1 1 1 (i, r ) ( j , s ) ( j , s ) (i, r ) I J IJ δ δ − δ − δ + where δ(i,r) = 1 if i = r and 0 if i ≠ r. Then Q is the quadratic form 1 a ' Aa N . Because A does not depend on N and because the elements of Γ converge to finite values, tr(AΓ) is finite and lim ( ) N E Q →∞ = tr(AΓ) + 1 lim ' N e Ae →∞ N where 11 ( , ..., ) IJ e = e e and . ( ) ij ij e = E a . Then lim ( ) N E Q →∞ is finite if and only if e'Ae = O ( N ) . Note that 2 . . .. 1 1 1 ( ) ( ) ij i j e e e e O N J I IJ e'Ae = Σ Σ − − + = is equivalent to 1 2 . . .. 1 1 1 ( ) i j i j e e e e O N J I IJ − − + = 24 for all i and j. Theorem 3.3 of Thompson and Ammann (1989) and Lemma 1.5.5.A of Serfling (1980) imply that ( , ) lim 0 N ij ij i j e μ →∞ γ − = where ( ) ij ij μ = N × E H and (i , j ) γ is the square root of the (i, j)th diagonal element of the covariance matrix Γ where the (i, j), (r, s)th element of Γ is 1 1 1 1 1 1 co v ( ), ( ) J I J I v u v u ij ij u v r s r s u v H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Because 0 < ( i , j ) γ < ∞ and ( i , j ) γ does not depend on N, both eij and μij converge to the same limit as N increases. Therefore, . . .. 1 1 1 ij i j e e e e J I IJ − − + is 1 O(N 2 ) if and only if . . .. 1 1 1 ij i j J I IJ μ − μ − μ + μ is 1 O(N 2 ) , which is equivalent to . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = for all i and j where ( ) ij ij ν = E H . We can show this last equivalency using a contrapositive argument. Assume . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = C ≠ . Then . . .. 1 1 1 ( ) ij i j J I IJ μ − μ − μ + μ = CN and thus, 25 . . .. 1 1 1 lim( ) N ij i j J I IJ μ μ μ μ →∞ − − + = ∞ which is not 1 O(N 2 ) . Therefore, . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = . To obtain the results in (i), that is, ( ) ij aj E H − H does not depend on j for all 1 ≤ i,a ≤ I and 1≤ j ≤ J , subtract . . .. 1 1 1 0 aj a j J I IJ ν − ν − ν + ν = from . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = . This gives . . 1 ( ) ij aj i a J ν −ν = ν −ν which does not depend on j. The result for (ii), ( ) ij ib E H − H does not depend on i for all 1 ≤ i ≤ I and 1 ≤ j,b ≤ J , is obtained similarly. This completes Thompson’s proof. Note that Thompson only proved one direction of the theorem, that is that if lim ( ) N E T →∞ is finite then ( ) ij aj E H − H does not depend on j for all1 ≤ i, a ≤ I and 1 ≤ j ≤ J . When lim ( ) N E T →∞ is not finite, then Thompson noted that T was not asymptotically chisquared and becomes very liberal for large samples. Thompson also noted that the rank transform should not be used to detect interactions if (i) and (ii) of Theorem 3 can not be shown to hold. Thompson noted that Theorem 3 holds if there is only one main effect, that is when Fij = Fi or Fij = Fj. Thompson also noted that if both main effects were present, Theorem 3 holds only if there are two levels of each main effect and states the following: Corollary 4 (Thompson): When both main effects are present, conditions (i) and (ii) are satisfied for all values of αi and βj if and only if I = J = 2. 26 Proof (Thompson): Assume that I = J = 2. Conditions (i) and (ii) are equivalent to E (H11 − H 21 ) − E (H12 − H 22 ) = 0 . By expanding H(x) as a sum, changing variables in the integrals, and cancelling terms, this can be shown to be equivalent to ∫{F (x + 2α + 2β ) + F (x − 2α − 2β )} f (x)dx − ∫{F ( x + 2α − 2β ) + F ( x − 2α + 2β )} f ( x )dx = 0 . (13) To show that equation (13) always holds, we note that ∫{F ( x + δ ) + F ( x − δ )} f ( x)dx is a constant function in δ by showing that its partial derivative with respect to δ is ∫{ f ( x + δ ) − f ( x − δ )} f ( x )dx = 0 . Since the score function is nondifferentiable in only a countable number of points within the domain of the probability density function, using Leibniz’s Formula, the partial derivatives in the above equation can pass through the integral. Therefore, the integrals in equation (13) are constant with respect to α and β and therefore their difference is 0. Hence, conditions (i) and (ii) hold. Conversely, if J ≥ 3, a counter example to the condition that 1 2 ( ) j j E H − H does not depend on j is generated for symmetric distributions by letting α1 =  α2, β1 =  β2 and βj = 0 for 3 ≤ j ≤ J . Then 11 21 12 22 13 23 E (H − H ) = E (H − H ) ≠ E (H − H ) . Counterexamples for I ≥ 3 and for nonsymmetric distributions are handled similarly. This concludes Thompson’s proof of Corollary 4. Thompson proved that when only one main effect was present, or if each main effect had only two levels if both main effects were present, the asymptotic distribution 27 of the rank transform statistic, T, was 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + by Lemma 1 and Lemma 2. Lemma 1 stated that the aij. were normally distributed. Lemma 2 stated that the denominator of T, (IJ – I – J + 1)D converges in probability to a constant. Thompson assumes that the aij.’s are also independent, so the square of their summed values, and therefore T, has a chisquare distribution. Conover and Iman (1976) use a similar test statistic with the ranked values and state that the test statistic has an asymptotic chisquared distribution, but they do not specifically state that their ranked values are independent. One goal is to determine if the aligned rank transform allows for more than two levels of each main effect when both effects are present. Using a similar alignment as that in equation (1), but removing the subject, using the intervals for i and j that were defined by Thompson, and defining * ij X as the aligned value of observation Xij, we see the following for the alignment: * ij ij i. . j .. X = X − X − X + X ( ) i j ij ijn =θ +α + β + αβ +ε 1 . 1 ( ( ) ) J j i j ij ij J θ α β αβ ε = − Σ + + + + 1 . 1 ( ( ) ) I i i j ij ij I θ α β αβ ε = − Σ + + + + 1 1 . 1 ( ( ) ) I J i j i j ij ij IJ θ α β αβ ε = = + ΣΣ + + + + ( ) i j ij ijn =θ +α + β + αβ +ε 28 1 1 1 . 1 1 1 ( ) J J J j j j i j ij ij J J J θ α β αβ ε = = = − − Σ − − Σ − Σ 1 1 1 . 1 1 1 ( ) I I I i i i i i j ij j I I I θ α β αβ ε = = = − − − Σ − Σ − Σ 1 1 1 1 1 1 . 1 1 1 1 ( ) ( ) I J I J I J i j i j i j i j ij ij J I IJ IJ θ α β αβ ε = = = = = = + + Σ + Σ + Σ Σ + Σ Σ This can simplify under the conditions of Thompson, . 0 i i α = Σα = , . 0 j j β = Σβ = , . ( ) ( ) 0 j i ij αβ = Σ αβ = and . ( ) ( ) 0 i j ij αβ = Σ αβ = . Under these conditions, the alignment becomes: * ij X ( ) i j ij ijn = θ + α + β + αβ + ε 1 . 1 0 0 J j j ij J θ β ε = − − − − − Σ 1 . 1 0 0 I i i ij I θ α ε = − − − − − Σ 1 1 . 1 0 0 0 I J i j i j IJ θ ε = = + + + + + Σ Σ 1 1 1 1 . . . 1 1 1 ( ) J I I J j i i j ij ijn ij ij ij J I IJ α β ε ε ε ε = = = = = + − Σ − Σ + Σ Σ Under the null hypothesis of no interactions, (αβ)ij = 0, this further simplifies to: 1 1 1 1 * . . . 1 J 1 I 1 I J j i i j i j i jn i j ij i j X J I IJ ε ε ε ε = = = = = − Σ − Σ + Σ Σ Thompson defines the distribution of Xijn under the null hypothesis as ( ) ( ) ij i j F x = F x −θ −α − β . After alignment, we see the distribution of * ijn X under the 29 null hypothesis is Fij ( x* ) = F ( x* ' ) where *' * i j x = x −θ −α − β and * * ( ( )) ( ( )) 0 ij E F x = E F x = . Using this alignment, we can recreate the work of Thompson. First, we define * * * . 1 ( ) ( ) 1 i n ij ij jn e E a E R IJN = = + Σ , where * ijn R is the aligned rank of Xij. Note that we do not need to redefine H(x), which was the average distribution function, since we have only changed the notation of our random variable to * x . Therefore, we also do not need to redefine ij μ or ij ν in terms of the alignment since both are defined using H(x). Although we do not need to redefine H(x), we will denote * ( ) ij H x as * ij H . By replacing our definitions in the proof of Theorem 3, we can obtain the results of the Theorem for the aligned rank transform. We will redefine the following using the aligned ranks, * ijn R , * * ( ) / 1 ijn ijn a = R IJN + , 2 1 1 * * * * * . . . . . . . . 1 J I 1 1 1 j i i j i j Q a a a a N = = J I I J = − − + Σ Σ , 2 1 1 1 * * * . 1 N J I 1 n j i i jn i j D a a I JN IJ = = = N = − − Σ Σ Σ , and the statistic * * ( 1) * Q T I J I J D = − − + . Notice that the definition of * ijn a depends only on the ranked values and the number of observations. Conover and Iman (1976) showed that the aligned rank yields independent 30 observations. Therefore, our aligned ranked values are still independent ranked values and thus the * ijn a are still independent as defined in Q* and utilized by Thompson. Let * * * 11. . ( , ..., ) IJ a = a a ′ and 11. . ( , ..., ) IJ μ = μ μ ′ where * 1 1 * 1 ( ) ( ( )) I J a b ij ij ab ij N E H N E F X IJ μ = = = × = × Σ Σ . Let * (i , j ) γ be the square root of the (i, j)th diagonal element of the covariance matrix Γ* where the (i, j), (r, s)th element of Γ* is * * * * 1 1 1 1 1 1 cov ( ), ( ) J I J I v u v u ij ij uv rs rs uv H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Also let * 2 ( i , j ) γ be the (i, j)th diagonal element of Γ*. Since 0 < var(H* ij) < ∞, then 0 < * (i , j ),( r ,s ) γ < ∞. As with Thompson’s work, we will state and prove two lemmas in order to show that our test statistic has a χ 2 distribution. Lemma 1: Under the null hypothesis, 1 2 * * . ( , ) ( ) i j i j i j N a μ γ − − converges in distribution to N (0,1) . Proof: Apply Theorem 3.3 from Thompson and Ammann (1989) to the linear rank statistic * ij. a with Wilcoxon scores. The regularity conditions of Theorem 3.3 should still hold since we have only changed the location parameters using our alignment. In particular, the score function, more specifically the alignment, has a bounded second derivative and constants that do not depend on n or N. From Theorem 3.3, we know that 1 2 * * . ( , ) ( ) ij i j i j N a μ γ − − converges in distribution to N(0,1) if * 2 ( , ) 1 lim ( ) 0 N i j N γ →∞ > . Thompson 31 (1991) showed that 2 ( , ) 1 lim ( ) 0 N i j N γ →∞ > . Recall that * * 1 ( ) ( ) i j ij H x F x IJ = ΣΣ and Fij ( x * ) = F ( x * ' ) where *' * i j x = x −θ −α − β . Since * ( i , j ) γ is defined using only the average distribution function H* (x) and the distribution function * ( ) ij F x , the limit should not change with our definition of * ( i , j ) γ . Thus * 2 ( , ) 1 lim ( ) 0 N i j N γ →∞ > . We also know that from Hajek (1968), * * ( , ) . var( ) (1)max i j ij ijn γ − a ≤ O d − d , where dijn are constants that under the assumptions of Theorem 3.3 do not depend on n or N and d is the average of the dijn. Since , , max i j n ijn d − d does not depend on N, then since * ( i , j ) γ →∞, var( * ij . a )→∞ as N→∞. So, with * ij . a substituted in for SN in Theorem 3.2 (see appendix) of Thompson and Ammann (1989), Theorem 3.2 holds for all N sufficiently large and thus 1 2 * * . ( , ) ( ) i j i j i j N a μ γ − − converges in distribution to N(0,1). Lemma 2: Under the null hypothesis of no interaction, D* converges in probability to the nonnegative, finite constant { }2 2 * * 1 1 1 ( ) va r( ) 3 ij ij E H H IJ IJ σ = − Σ Σ = Σ Σ Proof: This follows from Thompson’s proof of Lemma 2 (1991) which is almost identical to the proof of Theorem 5.3 of Thompson and Ammann (1989) by using the linear rank statistic * ij. a with Wilcoxon scores. D* can be considered as an ANOVAtype sum of squares that is based on a different variable that is scalesimilar to D and any convergence in probability should be preserved. Therefore if D, as defined as in 32 Thompson (1991), converges in probability to a constant, then D* will also converge in probability to a constant. Under the null hypothesis of no interactions, T* converges in distribution to 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + by Lemma 1 and Lemma 2. Thompson (1991) showed that the ranked data converged to a χ 2 distribution by Lemma 1 and 2 of Thompson. We have proved that Lemma 1 and 2 still hold for the aligned ranks. Therefore, the test statistic T* for the aligned values converges to 2 ( 1) / ( 1) IJ I J χ IJ I J − − + − − + . Simulation studies were run for a double exponential error term with a compound symmetric covariance structure with various levels of N. The studies showed that as N increased (3, 10, 15, 30 and 45), in particular as the number of subjects increased, the error rate for the test of interactions approached the 0.05 level. Compound Symmetric Covariance Structure – 10000 repetitions Test for Interaction Treatment and Repeated Measures Main Effects Present Double Exponential Error Terms Bolded Values represend observed error rates that are within 2 standard errors of 0.05 Number of Subjects Total Number of Observations Observed Error Rate 3 37 0.049 10 90 0.042 15 135 0.054 30 270 0.047 45 405 0.048 Table 1 33 Theorem 3: Under the null hypothesis of no interaction, lim ( ) N E T →∞ is finite if and only if (i) * * ( ) ij aj E H − H does not depend on j for all 1 ≤ i, a ≤ I and 1 ≤ j ≤ J (ii) * * ( ) ij ib E H − H does not depend on i for all 1 ≤ i ≤ I and 1 ≤ j,b ≤ J Proof: Define an IJ x IJ matrix A as having elements 1 1 1 (i, r ) ( j , s ) ( j , s ) (i, r ) I J IJ δ δ − δ − δ + where δ(i,r) = 1 if i = r and 0 if i ≠ r. Then * E (Q ) is finite if and only if = O ( N ) * * e 'A e where * * * 1 1 ( , ..., ) IJ e = e e with * * . ( ) ij ij e = E a . Note that * * * * 2 . . .. 1 1 1 ( ) ( ) ij i j e e e e O N J I IJ = Σ Σ − − + = * * e 'Ae is equivalent to 1 * * * * 2 . . .. 1 1 1 ( ) ij i j e e e e O N J I IJ − − + = for all i and j. Applying Theorem 3.3 of Thompson and Ammann (1989) to * ij. a we see that * * * . ( , ) ( , ) d ij ij i j a →N e γ and * * * . ( , ) ( , ) d ij ij i j a →N μ γ . Applying this result to Lemma 1.5.5.A of Serfling (1980), we see that * * ( , ) lim 0 N ij ij i j e μ →∞ γ − = where * * 1 1 1 ( ) ( ( )) ( ) I J a b ij ij ab ij ij N E H N E F X N E H IJ μ = = = × = × Σ Σ = × and * (i , j ) γ is the square root of the (i, j)th diagonal element of the covariance matrix Γ where the (i, j), (r, s)th element of Γ is 34 * * * * 1 1 1 1 1 1 cov ( ), ( ) J I J I v u v u ij ij uv rs rs uv H F X H F X IJ = = IJ = = − − Σ Σ Σ Σ . Because 0 < * (i , j ) γ < ∞, both * ij e and * ij μ converge to the same limit as N increases. Therefore, * * * * . . .. 1 1 1 ij i j e e e e J I IJ − − + is 1 O(N 2 ) if and only if . . .. 1 1 1 ij i j J I IJ μ − μ − μ + μ is 1 O(N 2 ) , which is equivalent to . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = for all i and j where * ( ) ij ij ν = E H . To obtain (i), subtract . . .. 1 1 1 0 aj a j J I IJ ν − ν − ν + ν = from . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = . This gives * * . . 1 ( ) ( ) ij aj ij aj J i a E H −H =ν −ν = ν −ν which does not depend on j for all i and j. Thus, if . . .. 1 1 1 0 ij i j J I IJ ν − ν − ν + ν = , * * ( ) ij aj E H − H does not depend on j for all i and j. To show the other direction, we will first assume that . . .. 1 1 1 ( ) 0 ij i j J I IJ ν − ν − ν + ν = f j ≠ for some j, say jʹ. If we then subtract . . .. 1 1 1 0 aj a j J I IJ ν ν ν ν ′ ′ − − + = from . . .. 1 1 1 ( ') 0 ij i j J I IJ ν ν ν ν f j ′ ′ − − + = ≠ , we see that . . 1 1 ( ') 0 ij aj i a v v f j J J ν ν ′ ′ − − + = ≠ . This means that * * ( ) ij aj E H − H depends on j for some value of j. Since . . .. 1 1 1 ( ) 0 ij i j J I IJ ν − ν − ν + ν = f j ≠ for this value of 35 j, then . . .. 1 1 1 ij i j J I IJ μ − μ − μ + μ is not 1 O(N 2 ) for all i and j, * * * * . . .. 1 1 1 ij i j e e e e J I IJ − − + is not 1 O(N 2 ) for all i and j, and thus * E (Q ) is not finite. The result for (ii) is obtained similarly. This completes the proof. The goal is to now show that Theorem 3 holds when both main effects are present, even if more than two levels of each main effect are present. Corollary 4: When both main effects are present, conditions (i) and (ii) of Theorem 3 are satisfied for all values of αi and βj for any number of levels i or j. Proof: Assume I=2, J=3. Conditions (i) and (ii) are equivalent to * * * * * * 11 21 12 22 13 23 E(H − H ) = E(H − H ) = E(H − H ) . First we will show * * * * 11 21 12 22 E(H − H ) − E(H − H ) = 0 . * * * * * * * * 11 21 12 22 11 21 12 22 E(H − H ) − E(H − H ) = E(H ) − E(H ) − E(H ) + E(H ) { } 1 1 * * * * 11 21 12 22 1 ( ( ) ( ) ( ) ( ) ) I J a b ab ab ab ab E F x F x F x F x IJ = = = ΣΣ − − + { } 1 1 * * * * 11 21 12 22 1 ( ( )) ( ( )) ( ( )) ( ( )) I J a b ab ab ab ab E F x E F x E F x E F x IJ = = = ΣΣ − − + = 0 Similarly, * * * * 12 22 13 23 E(H − H ) − E(H − H ) = 0 and * * * * 11 21 13 23 E(H − H ) − E(H − H ) = 0. Results for I = 3, J = 2 can be obtained in a similar manner. Therefore, conditions (i) and (ii) of Theorem 3 are satisfied when one main effect has three levels. When there are three or more levels for each main effect, any 36 nontrivial difference of Hij’s will have an expected value of zero. We will consider the case when I = 3 and J = 3. For this case, we need to show that * * * * * * E(H11 − H21 ) = E(H12 − H22 ) = E(H13 − H23 ) , * * * * * * 11 31 12 32 13 33 E(H − H ) = E(H − H ) = E(H − H ) , and * * * * * * 21 31 22 32 23 33 E(H − H ) = E(H − H ) = E(H − H ) . First consider * * 1 2 ( ) j j E H − H , where j = 1, 2, 3. We know * * 1 2 ( ) j j E H − H { * * } 1 1 1 2 1 ( ( ) ( ) ) I J a b ab j ab j E F x F x IJ = = = ΣΣ − { * * } 1 1 1 2 1 ( ( )) ( ( )) 0 I J a b ab j ab j E F x E F x IJ = = = ΣΣ − = . For * * 1 3 ( ) j j E H − H , where j = 1, 2, 3, we see * * 1 3 ( ) j j E H − H { * * } 1 1 1 3 1 ( ( ) ( ) ) I J a b ab j ab j E F x F x IJ = = = ΣΣ − { * * } 1 1 2 3 1 ( ( )) ( ( )) 0 I J a b ab j ab j E F x E F x IJ = = = ΣΣ − = . And for * * 2 3 ( ) j j E H − H , where j = 1, 2, 3, we see * * 2 3 ( ) j j E H − H { * * } 1 1 2 3 1 ( ( ) ( ) ) I J a b ab j ab j E F x F x IJ = = = ΣΣ − { * * } 1 1 2 3 1 ( ( )) ( ( )) 0 I J a b ab j ab j E F x E F x IJ = = = ΣΣ − = . Results for more than three levels of main effects can be proven similarly. Thus, the conditions of (i) and (ii) of Theorem 3 are satisfied for any number of levels of the main effects. 37 Lemma 1 stated that the * ij. a terms were normally distributed and Lemma 2 stated that the denominator of T* converges in probability to a constant. Therefore, by Lemma 1 and 2, the test statistic T* for the aligned values converges to 2 ( IJ I J 1) k χ − − + × where ( 1) 1 IJ I J k − − + = . The Analysis of Variance analog from Thompson supports the notion that this has IJ – I – J +1 degrees of freedom. Thus, T* will converge to this distribution no matter how many levels there are of the main effects. 38 CHAPTER IV SIMULATIONS A Monte Carlo study of the Type I error rates and power of four tests for interaction in a 3×3×3 completely randomized, balanced repeated measures experiment was conducted using SAS Version 9.1.3 (SAS Institute, Cary, NC). Five initial conditions were tested; no main effects or interactions, only treatment main effects, only repeated measures main effects, both treatment and repeated measures main effects, and only interactions. In addition to the initial conditions, four distributions were used for the error terms; normal, uniform, F and double exponential. These error distributions were selected to represent different values of kurtosis. Kurtosis is a measure of the level of peakedness or flatness of data values in the center of the graph of the distribution versus the tails of the graph when compared to the normal distribution. Distributions with higher kurtosis have heavier tails or more extreme values, while distributions with lower kurtosis have heavier middles or fewer extreme values. The normal distribution has a kurtosis of 3, the uniform distribution has a kurtosis of 1.2, an Fdistribution with parameters 3 and 5 has a kurtosis of 14, and the double exponential distribution has a kurtosis of 3. In addition to the error distributions and initial conditions, three covariance structures were used: variance components (VC), compound symmetric (CS), and a firstorder autoregressive (AR(1)). For the first order autoregressive structure, three values of ρ were considered, 0.75, 0.5 and 0.25. 39 Four tests were then used to test for interactions, the traditional Ftest, the rank transform (RT), the aligned rank transform using Higgins and Tashtoush’s (1994) naïve alignment for a completely randomized design, and the aligned rank transform using Higgins and Tashtoush’s alignment for a repeated measures design. Higgins and Tashtoush’s naïve alignment, .. . . .. ... ARYijk = Yijk −Yi −Y j −Y k + 2*Y , will be denoted ART1 and the aligned rank transform for a repeated measures design, ijk ijk ij. ..k ... ARY = Y −Y −Y +Y , will be denoted ART2. Higgins and Tashtoush showed that the naïve alignment has power advantages over the standard Ftest when wholeplot variances are smaller, but can lose power as the variances get larger. They also showed that the aligned rank transform for repeated measures had larger power than the standard Ftest for heavy tailed distributions. Their simulations also showed that the naïve alignment and repeated measures alignment has comparable power for many distributions when the wholeplot error variances were small, but the repeated measures alignment performs better when the error variance get larger. Therefore, both methods of Higgins and Tashtoush were used for comparison since various error distributions and specific values of the whole plot standard deviation were applied to the data. Simulation Results A total of 100 cases were considered from the five initial conditions, four error term distributions and five covariance structures combinations. Ten thousand repetitions were generated for each of the 100 cases and then the four tests were run on each repetition. Three levels of the treatment main effect, three subjects per treatment, and three repeated measures per subject were used for each repetition. For the variance 40 components covariance structure, the variance was assumed to be 1. For the compound symmetric covariance structure, σ2 was assumed to be 9 and σ1 2 was assumed to be 4. For the autoregressive covariance structures, the variance was assumed to be 1 and three values of ρ were used, 0.25, 0.5 and 0.75. When treatment main effects were present, the treatment 1 effect was 1, the treatment 2 effect was 2, and the treatment 3 effect was 4. When repeated measures main effects were present, the repeated measures 1 effect was 0, the treatment 2 effect was 1, and the treatment 3 effect was 1. When interactions were present, the effects for treatment 1 were 1, 2, 3, for treatment 2 were 2, 1, 2 and for treatment 3 were 3, 2, 1 where the first number listed for each treatment is for the repeated measure 1 effect, the second number is the repeated measure 2 effect and the third number is the repeated measure 3 effect. For all covariances except the variance components structure, at least one of the tests for each initial condition and error term distribution yielded less than ten thousand results due to the NewtonRaphson algorithm used to find the minimum of 2 times the logarithm of the restricted likelihood function not converging. The minimum number of repetitions that converged was 7640. Tables 2 through 6 give the simulation results for each of the 100 cases. Table 2 summarizes the results for all four error distributions and all five tests per distribution for the variance components covariance structure. Table 3 summarizes the results for the compound symmetric covariance structure. Summarizing the results for the autoregressive covariance structures are Table 4 using ρ = 0.75, Table 5 using ρ = 0.5, and Table 6 using ρ = 0.25, where ρ is the correlation between adjacent observations on the same subject. 41 For all four distributions of the error terms, the ART1 had error rates that were closer to the desired 5 percent significance level than the ART2, with the exception of the Fdistribution with a compound symmetric covariance structure. While the ART2 was a powerful test, it had error rates above the desired 0.05 level, except in the case of the compound symmetric covariance structure. However, in this case, there were only approximately 7640 repetitions. Therefore, it was not a 0.05 test for any of our error distribution and covariance structure combinations, so it will be excluded from further discussion. For normal error terms, while the error rates were above 5 percent for the ART1 for all covariance structures, they were less than 6.5 percent. In fact, for all covariance structures except the autoregressive with ρ=0.75, the error rates were less than or equal to 5.75 percent. For all three autoregressive covariance structures, the ART1 had error rates that were closer to the 5 percent level than the standard F test or the RT (See Tables 4, 5 and 6). For the variance components and compound symmetric covariance structures, the ART1 had error rates that were larger than the standard F test or the RT. However, the error rate for the ART1 was less than or equal to 5.75 percent and was within 1 percent of the error rates for the other two tests. For uniform error terms, the ART1 had error rates similar to the standard F test. However, both tests had error rates higher than 5 percent but less than 8.9 percent. For sixteen of twenty covariance structures and initial effect combinations, the error rates were closer to the 5 percent level for the ART1 than for the standard F test. The error rates were slightly higher for the ART1 as opposed to the RT in all but four combinations, but the error rates for the ART1 in these situations were within 1 percent of the RT. 42 For F error terms, the ART1 had rates below 5 percent for the variance components and compound symmetric covariance structures (See Tables 2 and 3). The error rate for the ART1 was closer to the 5 percent level than the standard F test or the RT. The error rate for the standard F test was around 2 percent, while the RT had error rates around 4 percent, except when both main effects were present. In that case, the error rate for the RT was around 6 percent. For the autoregressive covariance structures, the ART1 had error rates closer to the 5 percent level than the standard F test and the RT in seven of the twelve error distribution and covariance structure combinations (See Tables 4, 5, and 6). In those cases where the ART1 was not the closest error rate, the RT was the closest to the 5 percent level, but the ART1 was within 0.2 percent of the RT in all but one case where it was within 0.6 percent. For double exponential error terms, the error rate for the ART1 was higher than the 5 percent level for the variance components covariance structure, but it was less than 5.8 percent (See Table 2). Both the standard F test and the RT had error rates closer to and below the 5 percent level with the RT being closer to 5 percent. For the compound symmetric covariance structure, all three tests had error rates below the 5 percent level, with the ART1 having error rates closer to 5 percent except when both main effects were present (See Table 3). In this case, the RT had an error rate of exactly 5 percent. For the autoregressive covariance structures, the ART1 had error rates that were further from the 5 percent level than the standard F test and in all but two cases, the error rates were further from the 5 percent level than the RT (See Tables 4, 5, and 6). However, all three tests had error rates between 6.5 and 9 percent. 43 Although the standard F test, RT and ART1 were not true 0.05 tests in many of our error distribution and covariance structure combinations, we would still like to examine the power of these tests. For normal error terms, the ART1 had power larger than the RT, but lower than the standard F test for the compound symmetric and variance components covariance structures (See Tables 2 and 3). For all three autoregressive covariance structures, the ART1 had the lowest power of the three tests, while the power for the ART1 for all five covariance structures was within 11.5 percent of the other two tests (See Tables 4, 5 and 6). Although the power was smaller in these cases, recall that the ART1 had error rates closer to the 5 percent level. For uniform error terms, the power for the ART1 was higher than the power of the RT, while the standard F test had the highest power. In the three cases where the power for the ART1 was at least 10 percent greater than the RT, the error rates of both tests were within 1 percent of each other. In the other two cases, the power for the ART1 was between 4.4 percent and 6 percent greater than the RT. In these cases, the error rates for the ART1 were within 0.6 percent of the RT. Recall that the error rates for the standard F test and the ART1 were similar. For F error terms, the ART1 had power that was greater than the standard F test, but less than the RT. Recall that the ART1 had error rates below 5 percent for the variance components and compound symmetric covariance structures (See Tables 2 and 3). The ART1 also had error rates closer to the 5 percent level than the RT or standard F test in seven of the twelve error distribution and covariance structure combinations for the autoregressive covariance structures (See Tables 4, 5 and 6). Also recall that for all combinations, the error rate for the ART1 was closer to the 5 percent level than the 44 standard F test. The ART1 also had error rates closer than the 5 percent level in seven of the twelve error distribution and covariance structure combinations and was within 0.6 percent of the error rate for the RT when the RT was the closest to the 5 percent level. For double exponential error terms, the ART1 had higher power than the standard F test. The ART1 also had higher power than the RT except for the autoregressive covariance structure when ρ=0.75. In this case, the power for the ART1 was less than 0.6 percent smaller than the RT. Recall that for the variance components covariance structure, the error rates for the RT were closest to the 5 percent level, while the standard F test had error rates less than the RT and the ART1 had error rates greater than the 5 percent level and greater than the RT. For the autoregressive covariance structures, all three tests had error rates between 6.5 and 9. 45 Variance Components Covariance Structure – 10000 repetitions Test for Interaction – Observed Error Rates Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0502 0.0522 0.0204 0.0435 Ranked 0.0508 0.0522 0.0381 0.0464 ART1 0.0563 0.0520 0.0424 0.0572 ART2 0.1352 0.1395 0.0929 0.1287 Treatment Main Effects Standard Test 0.0524 0.0522 0.0204 0.0435 Ranked 0.0515 0.0497 0.0396 0.0469 ART1 0.0575 0.0520 0.0424 0.0572 ART2 0.1343 0.1395 0.0929 0.1287 Repeated Measures Main Effects Standard Test 0.0524 0.0522 0.0204 0.0435 Ranked 0.0489 0.0484 0.0397 0.0466 ART1 0.0575 0.0520 0.0424 0.0572 ART2 0.1343 0.1395 0.0929 0.1287 Treatment and RM Main Effects Standard Test 0.0524 0.0522 0.0204 0.0435 Ranked 0.0526 0.0524 0.0632 0.0470 ART1 0.0575 0.0520 0.0424 0.0572 ART2 0.1343 0.1395 0.0929 0.1287 Interactions Standard Test 0.6762 0.5627 0.4162 0.4026 Ranked 0.6318 0.4441 0.6657 0.4365 ART1 0.6731 0.4886 0.5396 0.4515 ART2 0.8473 0.7545 0.6539 0.6247 Table 2 46 Compound Symmetric Covariance Structure – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9995 **  Less than 10000 repetitions, more than 7640 Rates within 2 standard errors (0.0044, 0.005) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0507 0.0473 0.0371 0.0485 ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Treatment Main Effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0525 0.0514 0.0410 0.0461* ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Repeated Measures Main Effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0496 0.0490 0.0421 0.0456 ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Treatment and RM Main Effects Standard Test 0.0523 0.0538 0.0201 0.0436 Ranked 0.0557 0.0523 0.0711 0.0500 ART1 0.0572* 0.0516 0.0433 0.0489* ART2 0.0662** 0.0623** 0.0434** 0.0605** Interactions Standard Test 0.8239 0.7261 0.4948 0.5347 Ranked 0.7729 0.5153 0.7393 0.5053 ART1 0.7925* 0.6347 0.6184 0.5503* ART2 0.8427** 0.7465** 0.6204** 0.5872** Table 3 47 Autoregressive Covariance Structure, ρ=0.75 – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9970 Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0815* 0.0807* 0.0372* 0.0657* Ranked 0.0756* 0.0711* 0.0600* 0.0661* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Treatment Main Effects Standard Test 0.0815* 0.0809* 0.0372* 0.0657* Ranked 0.0840* 0.0949* 0.0658* 0.0765* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Repeated Measures Main Effects Standard Test 0.0815* 0.0809* 0.0372* 0.0657 Ranked 0.0770* 0.0691* 0.0548* 0.0677* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Treatment and RM Main Effects Standard Test 0.0815* 0.0805* 0.0372* 0.0657* Ranked 0.0852* 0.0730* 0.1102* 0.0900* ART1 0.0644 0.0791* 0.0606* 0.0804* ART2 0.1623 0.1688 0.1224 0.1594 Interactions Standard Test 0.9115* 0.8671* 0.6149* 0.6616* Ranked 0.8949* 0.4747* 0.7778* 0.7015* ART1 0.8872 0.7979* 0.6851* 0.6946* ART2 0.9666 0.9379 0.8104 0.8198 Table 4 48 Autoregressive Covariance Structure, ρ=0.5 – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9970 Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0788* 0.0820* 0.0288* 0.0667* Ranked 0.0760 0.0743 0.0543 0.0725 ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Treatment Main Effects Standard Test 0.0788* 0.0820* 0.0288* 0.0666* Ranked 0.0794* 0.0781* 0.0590* 0.0677* ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Repeated Measures Main Effects Standard Test 0.0788* 0.0818* 0.0288* 0.0667* Ranked 0.0767* 0.0781* 0.0536* 0.0711* ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Treatment and RM Main Effects Standard Test 0.0788* 0.0816* 0.0288* 0.0666* Ranked 0.0815* 0.0808* 0.0968* 0.0762* ART1 0.0564 0.0836 0.0550 0.0728 ART2 0.1476 0.1565 0.1125 0.1434 Interactions Standard Test 0.8542* 0.7765* 0.5351* 0.5863* Ranked 0.8172* 0.5496* 0.7502* 0.6077* ART1 0.7789 0.7035 0.6374 0.6079 ART2 0.9529 0.9011 0.7549 0.7778 Table 5 49 Autoregressive Covariance Structure, ρ=0.25 – 10000 repetitions Test for Interaction – Observed Error Rates *  Less than 10000 repetitions, more than 9970 Rates within 2 standard errors (0.0044) are denoted in bold Distribution of Error Terms Normal Uniform F Double Exponential No effects Standard Test 0.0790* 0.0888* 0.0270* 0.0681* Ranked 0.0771* 0.0795* 0.0541* 0.0697* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Treatment Main Effects Standard Test 0.0790* 0.0887* 0.0270* 0.0683* Ranked 0.0811* 0.0829* 0.0576* 0.0727* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Repeated Measures Main Effects Standard Test 0.0790* 0.0890* 0.0270* 0.0683* Ranked 0.0791* 0.0800* 0.0517* 0.0707* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Treatment and RM Main Effects Standard Test 0.0790* 0.0886* 0.0269* 0.0684* Ranked 0.0800* 0.0808* 0.0893* 0.0736* ART1 0.0554 0.0857* 0.0528* 0.0795* ART2 0.1431 0.1512 0.0939 0.1349 Interactions Standard Test 0.7713* 0.6702* 0.5132* 0.5122* Ranked 0.7320* 0.5455* 0.7237* 0.5341* ART1 0.6694 0.6052* 0.6175* 0.5439 ART2 0.9118* 0.8372 0.7297 0.7134* Table 6 50 CHAPTER V CONCLUSION The objectives of this paper were 1) to find how the alignment for the aligned rank transform affects the repeated measures model, 2) to find the variance of the aligned observations, 3) to find the asymptotic distribution of the aligned rank transform test in a factorial setting, and 4) compare the standard test, rank transform test, and two approaches to the aligned rank transform test in analyzing a repeated measures design through Monte Carlo simulations. Objectives 1, 2, and 3 were covered in Chapter 3. In particular, we found that the aligned rank transform test had an asymptotic distribution that was 2 χ ( IJ I J 1) / ( IJ I J 1) − − + − − + . The results of the Monte Carlo simulation found that the error rates for the ART1 performed closer to the desired 5 percent significance than the ART2 for all covariance structures and all error distributions examined in this work, with the exception of one combination, the compound symmetric covariance structure and the Fdistribution. While the ART2 was a powerful test, it was not a 0.05 test as in all but one case, the error rates were larger than 0.05. Therefore, it was excluded from further discussion. For normal error distributions, the ART1 had error rates closer to the 5 percent level than the standard F test and the RT for the autoregressive covariance structures. For the variance components and compound symmetric covariance structures, the ART1 was within 1 51 percent of the 5 percent level, the standard F test error rate, and the RT error rate. For uniform error distributions, the ART1 was within 1 percent of the 5 percent level, the standard F test error rate, and the RT error rate for the variance components and compound symmetric covariance structures. For the autoregressive covariance structures, the ART1 had error rates closer to the 5 percent level than the standard F test and was within 1 percent of the error rates for the RT when the RT had error rates closer to the 5 percent level. For the Fdistribution, the ART1 had error rates closer to the 5 percent level than the standard F test for all five covariance structures. The ART1 also had error rates closer to the 5 percent level than the RT except for five cases in the autoregressive covariance structures. In these cases, the ART1 error rate was within 0.6 percent of the RT error rate. For the double exponential distribution, the standard F test had error rates closer to the 5 percent level than the RT or the ART1, but all three tests had error rates between 6.5 and 9 percent. If the error terms have normal, uniform, or F distributions, but the covariance structure is not known or not spherical, the ART1 should be used to test for interactions. If the covariance structure is spherical and the error terms are normal or uniform, the standard F test and the RT have slightly lower error rates than the ART1. For error terms that have an F distribution with spherical covariance structures, the ART1 should be used to test for interactions. If the error terms have a double exponential distribution and the covariance structure is unknown or is nonspherical, then the standard F test should be used to test for interactions. If the covariance structure is spherical, then the ART1 should be used to test for interactions. Overall, when testing for interactions in a repeated 52 measures design, especially in cases where the covariance structure is not known to be spherical and the error distributions are not light tailed, the ART1 should be used. Further studies of the effects of the covariance structure on tests for interaction in a repeated measures design could include investigating the results for an unstructured covariance structure. Since our simulation results suggest that ART1 performs better than the ART2, there should be further research into the effects of the naïve alignment on the model using Kroenecker product definitions and the effects of the naïve alignment on the works of Thompson (1991). 53 REFERENCES Agresti, A. and Pendergast, J. (1986). “Comparing Mean Ranks for Repeated Measures Data.” Communications in Statistics: Theory and Methods. 15, 14171433. Akritas, M.G. (1990). “The Rank Transform Method in Some TwoFactor Designs.” Journal of the American Statistical Association. 85, 7378. Akritas, M.G. (1991). “Limitations of the Rank Transform Procedure: A Study of Repeated Measures Designs, Part I.” Journal of the American Statistical Association. 86, 457460. Baguley, Thom (2004). “An Introduction to Sphericity.” Retrieved September 1, 2008 from http://www.ps.uci.edu/~markm/statistics/spheric.pdf. Bartlett, M.S. (1936). “The square root transformation in analysis of variance.” Supplement to the Journal of the Royal Statistical Society. 3, 6878. Bartlett, M.S. (1947). “The use of transformations.” Biometrics. 3, 3952. Beasley, T. M. (2000). “Nonparametric tests for analyzing interactions among intrablock ranks in multiple group repeated measures designs.” Journal of Educational and Behavioral Statistics. 25, 2059. Blair, R.C., Sawilowsky, S.S. and Higgins, J.J. (1987). “Limitations of the Rank Transform Statistic.” Communications in Statistics. B16, 11331144. Collier, R.O. Jr., Baker, F.B., Mandeville, G.K. and Hayes, T.F. (1967). “Estimates of test size for several test procedures based on conventional variance ratios in the repeated measures design.” Psychometrika. 32, 339353. Conover, W.J. and Iman, R.L. (1976). “On Some Alternative Procedures Using Ranks for the Analysis of Experimental Designs.” Communications in Statistics. A5, 14, 1349 1368. Conover, W.J. and Iman, R.L. (1981), “Rank Transformations as a bridge Between Parametric and Nonparametric Statistics.” American Statistician. 35, 124133. Conover, W.J. (1999). Practical Nonparametric Statistics (Third Edition). New York:Wiley. 54 Girden, E.R. (1992). ANOVA: Repeated Measures. Sage university paper series on qualitative applications in the social sciences, 84, Newbury Park, CA: Sage. Greenhouse, S.W. and Geisser, S. (1959). “On Methods in the Analysis of Profile Data.” Psychometrika, 24, 95112. Hajek, J. (1968). “Asymptotic Normality of Simple Linear Rank Statistics Under Alternatives.” The Annals of Mathmatical Statistics, 39, 325346. Harwell, M.R. and Serlin, R.C. (1994). “A Monte Carlo Study of the Friedman Test and Some Competitors in the Single Factor, Repeated Measures Design with Unequal Covariances.” Computational Statistics and Data Analysis, 17, 3549. Hettmansperger, T.P., (1984). Statistical Inference Based on Ranks. New York: Wiley. Higgins, J. J. and Tashtoush, S. (1994). “An Aligned Rank Transform Test for Interactions.” Nonlinear World, 1, 201211. Huynh, H. and Feldt, L.S. (1976). “Estimation of the Box Correction for Degrees of Freedom from Sample Data in Randomized Block and Splitplot Designs.” Journal of Educational Statistics, 1 (1), 6982. Iman, R.L. (1974). “A Power Study of a Rank Transform for the TwoWay Classification Model When Interaction May Be Present.” Canadian Journal of Statistics, 2, 227 239. Iman, R.L., Hora, S.C., Conover, W.J. (1984). “Comparison of Asymptotically DistributionFree Procedures for the Analysis of Complete Blocks.” Journal of the American Statistical Association, 79, 674685. Keselman, H.J., Algina, James, Kowalchuk, Rhonda K. (2001). “The Analysis of Repeated Measures Designs: A review.” British Journal of Mathematical and Statistical Psychology, 54, 120. Keselman, J.C., Lix, L.M., and Keselman, H.J. (1996). “The Analysis of Repeated Measurements: A Quantitative Research Synthesis.” British Journal of Mathematical and Statistical Psychology, 49, 275298. Kuehl, Robert (2000). Design of Experiments: Statistical Principles of Research Design and Analysis, Second Edition. Brooks/Cole. Mansouri, H. and Chang, G.H. (1995). “A Comparative Study of Some Rank Tests for Interaction.” Computational Statistics and Data Analysis, 19, 8596. 55 Mauchly, J.W. (1940). “Significance test for sphericity of a normal nvariate distribution.” Annals of Mathematical Statistics, 11, 204209. Maxwell, S.E. and Delaney (1990). Designing Experiments and Analyzing Data. Belmont, CA: Wadsworth. Serfling, R.J. (1980). Approximation Theorems of Mathematical Statistics. New York: Wiley. Stevens, J. (1992). Applied Mutivariate Statistics for the Social Sciences (Second edition). Hillsdale, NJ: LEA. Thompson, G.L. (1991). “A note on the rank transform for interactions.” Biometrika, 78, 697701. Thompson, G.L. and Ammann, L.P. (1989). “Efficacies of rank transform statistics in twoway models with no interactions.” Journal of the American Statistical Association, 84, 325330. Wilcox, R. R. (1998). “How many discoveries have been lost by ignoring modern statistical methods?” American Psychologist, 53, 300–314. Zimmerman, D.W. and Zumbo, B.D. (1993). “Relative Power of the Wilcoxon Test, the Friedman Test and Repeated Measures ANOVA on Ranks.” Journal of Experimental Education, 62, 7586. 56 APPENDICES 57 A.1 THEOREMS The following theorems were referenced in the paper and are stated here for clarification. All the following are from Thompson and Amman (1989): Let I be the number of blocks, J the number of treatments and N the number of replications for a twoway layout. Theorem 3.1: Let SN be a linear rank statistic such that 1 1 1 ( ) I J N N ijn M ijn i j n S d a R = = = = Σ Σ Σ where {dijn} are arbitrary regression constants that are not equal, aM is a rank score of Rijn, and Rijn is the rank of observation Xijn. If the score function φ has a bounded second derivative on (0,1), then 2 1 2 1 1 1 1 1 1 ( ( ) ) ( ) ( ) I J N I J N N N ijn ijn i j n i j n E S E S Z O N d d − = = = = = = − − Σ Σ Σ ≤ Σ Σ Σ − and 2 1 2 1 1 1 ( ) ( ) ( ) I J N N N ijn i j n E S μ O N − d = = = − ≤ Σ Σ Σ where 1 1 1 ( ( )) ( ) I J N N ijn ij i j n μ d φ H x dF x = = = = Σ Σ Σ ∫ and 1 1 1 1 ( ) ( ) ( ) ( ( )) ( ) 1 I J N ijn ab k ijn ijn ij ab a b k Z d d u x X F x H x dF x M φ = = = = − × − − ′ + Σ Σ Σ ∫ and 58 1 1 1 1 I J N ijn i j n d d M = = = = ΣΣΣ and 1 1 1 ( ) ( ) ( ) I J ij i j H x IJ F x − = = = Σ Σ Theorem 3.2: Under the conditions of Theorem 3.1, for any ε>0 there exists a constant Kε such that 2 , , var( ) max( ) N ijn i j n S K d d ε > − entails max Pr( ( ) var( ) ) ( ) N N N x S − E S < x S − Φ x < ε (3.6) where Φis the cdf of the standard normal distribution. The assertation remains true if var(SN) is replaced by 2 N σ in (3.6). Also, if 2 1 1 1 I J N i j n ijn d = = = ΣΣΣ is a bounded multiple of 2 1 1 1 ( ) I J N ijn i j n d d = = = ΣΣΣ − , the asseration remains true if E(SN) is replaced in (3.6) by N μ . Theorem 3.3: Let SN be a linear rank statistic such that the score function φ has a bounded second derivative and the constants {dijn} do not depend on n or N; that is, dijn = dij (1≤ n ≤ N, 1≤ i ≤ I , 1≤ j ≤ J ). If 2 1 lim 0 N N N σ →∞ > , then (SN – E(SN))/σN d→ N(0,1) and (SN – μN)/σN d→ N(0,1). Proof from Thompson: 2 1 lim 0 N N N σ →∞ > implies that N σ →∞ as N →∞. As shown in (5.6) of Hajek (1968), var( ) (1)max n N ijn σ − S ≤ O d − d . Since max ijn d − d does not depend on N, then both N σ →∞ and ( ) N var S →∞ as N →∞. Hence 59 2 , , var( ) max( ) i j n N ijn S K d d ε > − holds for all N sufficiently large and the desired result follows from Theorem 3.2. Theorem 4.1: If φ is a score function that is not constant a.e. with respect to a measure induced by Fi for some i, then 2 1 2 0 lim ( ) 0 d N N σ N σ j − →∞ = > and (a) ( ( ) ( ( ))) / ( ) (0,1) d N N N S j − E S j σ j →N (b) ( ( ) ( )) / ( ) (0,1) d N N N S j − μ j σ j →N and (c) 1 0 ( , ) ( ( )) ( ) p N i N S i j φ H x dF x − →∫ where the limits are taken along a sequence of Pitman alternatives. Theorem 5.3: Under the conditions of Theorem 4.1, 2 0 ( ) p N N D θ →σ . Note: 2 2 2 0 1 1 ( 1) 2 ( , ) ( 1) ( ) N i j J J N N S i j I J x dx J σ φ − − − = − ∫ ΣΣ where φ is a score function defined on (0,1) and 1 ( , ) ( ) N N M ijn n S i j a R = =Σ , with ( ) M ijn a R being defined as in Theorem 3.1 Proof from Thompson: 2 2 2 ( 1) 1 1 1 ( ) ( ) ( , ) ( 1) ( 1) M i j n i j N N ijn N I J J D a R S i j J IJ N J N N θ − − = − − − ΣΣΣ ΣΣ Theorem 4.1 implies that 1 ( , ) ( 1) N S i j N N − converges in probability to 60 ; 0 lim ( ( )) ( ) ( ( )) ( ) ( 1) N ij N i N N H x dF x H x dF x N N φ φ →∞ = − ∫ ∫ . Hence, 2 2 1 1 ( , ) ( 1) N i j J S i j J N N − − ΣΣ converges in probability to 2 0 1 1 [ ( ( )) ( )] I i i J J φ H x dF x = − Σ ∫ . Next, note that 2 ( ) M ijn i j n ΣΣΣa R is a constant and therefore invariant under the choice of hypothesis. Thus, 2 ( 1) 1 ( ) ( 1) M i j n ijn I J a R J IJ N − − ΣΣΣ converges to 2 ( 1) ( ) I J x dx J φ − ∫ and therefore, 2 0 ( ) p N N D θ →σ . 61 A.2 SAS CODE The following code was written in SAS version 9.1.3 and was used to run the simulations described in Chapter 4. A.2.1 NORMAL ERROR DISTRIBUTIONS, VARIANCE COMPONENTS COVARIANCE STRUCTURE, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions */ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1' new; run; PROC IML; Seed=0; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); 62 subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*Subject effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  VC right now, sigma2=1*/ Cov=I(3); /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create Xdata from X; append from X; Close Xdata; Create NormalData From Y; append from Y; Close NormalData; create Data1 var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1; 63 /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; edit Xdata; append from X; Close Xdata; edit NormalData; append from Y; Close NormalData; edit Data1; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1; end; Proc Printto print = '/simulations/mixedinfo' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=Tests; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=vc sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2; SET Tests; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; 64 IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3; SET Tests; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1'; run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1; SET Data1; PROC SORT DATA=DataR1; BY reps treatment subject repmeasure; Proc Rank Out=DataR1Rank; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1Rank; By reps treatment subject repmeasure; Proc Printto print = '/simulations/mixedinfo'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1Rank NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRank; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment); Repeated / type=vc sub=subject(treatment) r rcorr; 65 /*Interaction Test*/ DATA DataR2; SET TestsRank; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3; SET TestsRank; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2 R=AlignResid; Proc Printto print = '/simulations/residuals' new; run; PROC PRINT DATA=dataA2; run; Proc Printto log = '/logs/sim1'; run; PROC SORT; By reps treatment subject; 66 /*Rank residuals*/ PROC RANK OUT=DataA3; By reps; Var AlignResid; ranks ARY; Proc Printto print = '/simulations/mixedinfo'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA3; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign; Model ARY = treatmentrepmeasure / outp=predictedalign; Random subject(treatment); Repeated / type=vc sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4; SET TestsAlign; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5; SET TestsAlign; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; 67 run; /*Get Residuals from the data*/ PROC GLM DATA=Data1 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22 R=AlignResid2; Proc Printto print = '/simulations/residuals' new; run; PROC PRINT DATA=dataA22; run; Proc Printto log = '/logs/sim1'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23; By reps; Var AlignResid2; ranks ARY; Proc Printto print = '/simulations/mixedinfo'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2; Model ARY = treatmentrepmeasure / outp=predictedalign2; Random subject(treatment); Repeated / type=vc sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24; SET TestsAlign2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; 68 /*'Main Effect' Test*/ DATA DataA25; SET TestsAlign2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1'; run; Proc Printto print = '/simulations/simoutput' new; run; Proc Print Data=Data2; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; 69 Proc Print Data=DataA5; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1; SET Data1; run; quit; 70 A.2.2 NORMAL ERROR DISTRIBUTIONS, COMPOUND SYMMETRIC COVARIANCE STRUCTURE, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  CS Covariance */ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1CS' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*Subject effects*/ taus={0,0,0}; /*Matrix with nx1 subject effects*/ 71 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  Compound Symmetric  sigma^2=9, sigma1^2=4*/ /* Values of sigma chosen to get a positive definite matrix */ Cov={13 4 4, 4 13 4, 4 4 13}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); BCov=(1/13)*BCov; /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; Create XdataCS from X; append from X; Close XdataCS; Create NormalDataCS From Y; append from Y; Close NormalDataCS; create Data1CS var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1CS; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ 72 Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; edit XdataCS; append from X; Close XdataCS; edit NormalDataCS; append from Y; Close NormalDataCS; edit Data1CS; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1CS; end; Proc printto print = '/simulations/mixedinfoCS' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1CS NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsCS; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2CS; SET TestsCS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3CS; SET TestsCS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; 73 ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1CS'; run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1CS; SET Data1CS; PROC SORT DATA=DataR1CS; BY reps treatment subject repmeasure; Proc Rank Out=DataR1RankCS; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1RankCS; By reps treatment subject repmeasure; Proc printto print = '/simulations/mixedinfoCS'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1RankCS NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRankCS; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataR2CS; SET TestsRankCS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3CS; 74 SET TestsRankCS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1CS'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1CS; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1CS NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2CS R=AlignResid; Proc printto print = '/simulations/residualsCS' new; run; PROC PRINT DATA=dataA2CS; run; Proc Printto log = '/logs/sim1CS'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA3CS; By reps; Var AlignResid; ranks ARY; Proc printto print = '/simulations/mixedinfoCS'; run; 75 /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA3CS; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlignCS; Model ARY = treatmentrepmeasure / outp=predictedalign; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4CS; SET TestsAlignCS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5CS; SET TestsAlignCS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1CS'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1CS; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1CS NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22CS R=AlignResid2; Proc printto print = '/simulations/residualsCS' new; 76 run; PROC PRINT DATA=dataA22CS; run; Proc Printto log = '/logs/sim1CS'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23CS; By reps; Var AlignResid2; ranks ARY; Proc printto print = '/simulations/mixedinfoCS'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23CS; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2CS; Model ARY = treatmentrepmeasure / outp=predictedalign2; Random subject(treatment) / G; Repeated / type=cs sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24CS; SET TestsAlign2CS; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA25CS; SET TestsAlign2CS; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; 77 proc printto log = '/logs/sim1CS'; run; Proc printto print = '/simulations/simoutputCS' new; run; Proc Print Data=Data2CS; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3CS; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2CS; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3CS; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24CS; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25CS; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4CS; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; Proc Print Data=DataA5CS; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1CS; SET Data1CS; run; quit; 78 A.2.3 NORMAL ERROR DISTRIBUTIONS, AUTOREGRESSIVE COVARIANCE STRUCTURE, ρ=0.75, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  AR(1) Covariance*/ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1AR' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*rep measure effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ 79 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  AR(1)  sigma^2=1, rho = 0.75*/ Cov={1 0.75 0.5625, 0.75 1 0.75, 0.5625 0.75 1}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); BCov2=I(9)@Cov; /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create XdataAR from X; append from X; Close XdataAR; Create NormalDataAR From Y; append from Y; Close NormalDataAR; create Data1AR var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1AR; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; 80 edit XdataAR; append from X; Close XdataAR; edit NormalDataAR; append from Y; Close NormalDataAR; edit Data1AR; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1AR; end; Proc printto print = '/simulations/mixedinfoAR' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1AR NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAR; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2AR; SET TestsAR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3AR; SET TestsAR; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; 81 proc printto log = '/logs/sim1AR'; run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1AR; SET Data1AR; PROC SORT DATA=DataR1AR; BY reps treatment subject repmeasure; Proc Rank Out=DataR1RankAR; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1RankAR; By reps treatment subject repmeasure; Proc printto print = '/simulations/mixedinfoAR'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1RankAR NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRankAR; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataR2AR; SET TestsRankAR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3AR; SET TestsRankAR; 82 IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1AR'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1AR; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2AR R=AlignResid; Proc printto print = '/simulations/residualsAR' new; run; PROC PRINT DATA=dataA2AR; run; Proc Printto log = '/logs/sim1AR'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA3AR; By reps; Var AlignResid; ranks ARY; Proc printto print = '/simulations/mixedinfoAR'; run; /*Mixed analysis on Aligned data */ 83 PROC MIXED DATA=DataA3AR; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlignAR; Model ARY = treatmentrepmeasure / outp=predictedalign; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4AR; SET TestsAlignAR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5AR; SET TestsAlignAR; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1AR'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1AR; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22AR R=AlignResid2; Proc printto print = '/simulations/residualsAR' new; run; 84 PROC PRINT DATA=dataA22AR; run; Proc Printto log = '/logs/sim1AR'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23AR; By reps; Var AlignResid2; ranks ARY; Proc printto print = '/simulations/mixedinfoAR'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23AR; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2AR; Model ARY = treatmentrepmeasure / outp=predictedalign2; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24AR; SET TestsAlign2AR; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA25AR; SET TestsAlign2AR; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1AR'; 85 run; Proc printto print = '/simulations/simoutputAR' new; run; Proc Print Data=Data2AR; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3AR; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2AR; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3AR; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24AR; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25AR; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4AR; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; Proc Print Data=DataA5AR; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1AR; SET Data1AR; run; quit; 86 A.2.4 NORMAL ERROR DISTRIBUTIONS, AUTOREGRESSIVE COVARIANCE STRUCTURE, ρ=0.5, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  AR2(1) Covariance*/ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1AR2' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*rep measure effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ 87 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  AR2(1)  sigma^2=1, rho = 0.75*/ Cov={1 0.5 0.25, 0.5 1 0.5, 0.25 0.5 1}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create XdataAR2 from X; append from X; Close XdataAR2; Create NormalDataAR2 From Y; append from Y; Close NormalDataAR2; create Data1AR2 var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1AR2; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; 88 edit XdataAR2; append from X; Close XdataAR2; edit NormalDataAR2; append from Y; Close NormalDataAR2; edit Data1AR2; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1AR2; end; Proc printto print = '/simulations/mixedinfoAR2' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1AR2 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAR2; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2AR2; SET TestsAR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA Data3AR2; SET TestsAR2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1AR2'; 89 run; TITLE 'Ranked Data'; run; /*Rank the data*/ DATA DataR1AR2; SET Data1AR2; PROC SORT DATA=DataR1AR2; BY reps treatment subject repmeasure; Proc Rank Out=DataR1RankAR2; By reps; Var Y; Ranks RankY; Proc Sort Data=DataR1RankAR2; By reps treatment subject repmeasure; Proc printto print = '/simulations/mixedinfoAR2'; run; /*Analysis on Ranked Data*/ PROC MIXED DATA=DataR1RankAR2 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsRankAR2; Model RankY = treatmentrepmeasure / outp=predictedrank; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataR2AR2; SET TestsRankAR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataR3AR2; SET TestsRankAR2; 90 IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; proc printto log = '/logs/sim1AR2'; run; /*Align based on Higgins and Tashtoush*/ PROC SORT DATA=Data1AR2; BY reps treatment subject repmeasure; TITLE 'Aligned Data  H&T'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR2 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment*subject repmeasure; OUTPUT OUT=DataA2AR2 R=AlignResid; Proc printto print = '/simulations/residualsAR2' new; run; PROC PRINT DATA=dataA2AR2; run; Proc Printto log = '/logs/sim1AR2'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA3AR2; By reps; Var AlignResid; ranks AR2Y; Proc printto print = '/simulations/mixedinfoAR2'; run; 91 /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA3AR2; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlignAR2; Model AR2Y = treatmentrepmeasure / outp=predictedalign; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA4AR2; SET TestsAlignAR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA5AR2; SET TestsAlignAR2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; proc printto log = '/logs/sim1AR2'; run; /*Align based on Residuals*/ PROC SORT DATA=Data1AR2; BY reps treatment subject repmeasure; TITLE 'Aligned Data  Residuals'; run; /*Get Residuals from the data*/ PROC GLM DATA=Data1AR2 NOPRINT; BY reps; CLASS treatment subject repmeasure; Model y = treatment subject repmeasure; OUTPUT OUT=DataA22AR2 R=AlignResid2; Proc printto print = '/simulations/residualsAR2' new; 92 run; PROC PRINT DATA=dataA22AR2; run; Proc Printto log = '/logs/sim1AR2'; run; PROC SORT; By reps treatment subject; /*Rank residuals*/ PROC RANK OUT=DataA23AR2; By reps; Var AlignResid2; ranks AR2Y; Proc printto print = '/simulations/mixedinfoAR2'; run; /*Mixed analysis on Aligned data */ PROC MIXED DATA=DataA23AR2; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAlign2AR2; Model AR2Y = treatmentrepmeasure / outp=predictedalign2; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA DataA24AR2; SET TestsAlign2AR2; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main Effect' Test*/ DATA DataA25AR2; SET TestsAlign2AR2; IF Effect = 'TREATMENT*REPMEASURE' THEN DELETE; IF Effect = 'TREATMENT' and ProbF >0.05 THEN RejectTrt=0; ELSE IF Effect = 'TREATMENT' and ProbF <= 0.05 THEN RejectTrt=1; IF Effect = 'REPMEASURE' and ProbF >0.05 THEN RejectRM=0; ELSE IF Effect = 'REPMEASURE' and ProbF <= 0.05 THEN RejectRM=1; run; 93 proc printto log = '/logs/sim1AR2'; run; Proc printto print = '/simulations/simoutputAR2' new; run; Proc Print Data=Data2AR2; TITLE 'Original Data  Interaction'; Sum Reject; Proc Print Data=Data3AR2; TITLE 'Original Data  No Interaction'; Sum RejectTrt RejectRM; Proc Print Data=DataR2AR2; Title 'Fit Statistics for Ranked Data'; Sum Reject; Proc Print Data=DataR3AR2; Title 'Test Info for Ranked Data'; Sum RejectTrt RejectRM; Proc Print Data=DataA24AR2; Title 'Fit Statistics for Aligned Data  Residuals'; Sum Reject; Proc Print Data=DataA25AR2; Title 'Test Info for Aligned Data  Residuals'; Sum RejectTrt RejectRM; Proc Print Data=DataA4AR2; Title 'Fit Statistics for Aligned Data  H&T'; Sum Reject; Proc Print Data=DataA5AR2; Title 'Test Info for Aligned Data  H&T'; Sum RejectTrt RejectRM; proc printto; DATA mylib.Data1AR2; SET Data1AR2; run; quit; 94 A.2.5 NORMAL ERROR DISTRIBUTIONS, AUTOREGRESSIVE COVARIANCE STRUCTURE, ρ=0.25, NO MAIN EFFECTS /**** This program will do the basic simulation: Normal errors / and no main effects or interactions  AR3(1) Covariance*/ dm 'log;clear;output;clear;'; options ps=80 ls=120 nodate pageno=1; libname mylib 'd:/datasets'; PROC PRINTTO log = '/logs/sim1AR3' new; run; PROC IML; Seed=10; /*Number of Treatments*/ trt=3; /*Number of Subjects*/ subj=3; /*Number of Repeated Measures*/ repmeas=3; /*Number of total observations*/ n=trt*subj*repmeas; /*Initial setup of data sets*/ replication=1; reps=J(n,1,replication); observation=t(1:n); treatment=J(subj,1,1)@{1,2,3}@J(repmeas,1,1); subject={1,2,3}@J(trt*repmeas,1,1); repmeasure=J(trt*subj,1,1)@{1,2,3}; /*Value of the common mean*/ mu=0; /*Matrix that is nx1 with common mean*/ mumatrix=mu*J(n,1,1); /*Treatment Effects*/ alphas={0,0,0}; /*Matrix with nx1 treatment effects*/ alphamatrix=J(subj,1,1)@alphas@J(repmeas,1,1); /*rep measure effects*/ taus={0,0,0}; /*Matrix with nx1 rep measure effects*/ 95 taumatrix=J(trt*repmeas,1,1)@taus; /*Interactions*/ alphatau={0,0,0,0,0,0,0,0,0}; /*Matrix with nx1 Interactions*/ alphataumatrix=J(repmeas,1,1)@alphatau; /*Covariance matrix  AR3(1)  sigma^2=1, rho = 0.75*/ Cov={1 0.25 0.0625, 0.25 1 0.25, 0.0625 0.25 1}; /*Block matrix with Cov trt*subj*/ BCov=Block(Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov,Cov); /*Choleski Root*/ T=Root(BCov); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + T*dmatrix; Create XdataAR3 from X; append from X; Close XdataAR3; Create NormalDataAR3 From Y; append from Y; Close NormalDataAR3; create Data1AR3 var { observation reps subject treatment repmeasure Y dmatrix X}; append; Close Data1AR3; /*Replication*/ DO replication = 2 to 10000; reps=J(n,1,replication); /*Initialize X matrix for observations  nx1*/ X=J(NRow(BCov),1,Seed); X=Rannor(X); rmerror=J(trt*subj,1,1); rmerror=Rannor(rmerror); dmatrix=rmerror@J(repmeas,1,1); /*Matrix with observations*/ Y=T*X + mumatrix + alphamatrix + taumatrix + alphataumatrix + dmatrix; 96 edit XdataAR3; append from X; Close XdataAR3; edit NormalDataAR3; append from Y; Close NormalDataAR3; edit Data1AR3; append var { observation reps subject treatment repmeasure Y dmatrix X}; Close Data1AR3; end; Proc printto print = '/simulations/mixedinfoAR3' new; run; TITLE 'Regular Data'; run; /*Mixed analysis on regular data*/ PROC MIXED DATA=Data1AR3 NOINFO NOITPRINT; BY reps; CLASS treatment subject repmeasure; ods output Tests3=TestsAR3; Model y = treatmentrepmeasure / outp=predicted; Random subject(treatment) / G; Repeated / type=ar(1) sub=subject(treatment) r rcorr; /*Interaction Test*/ DATA Data2AR3; SET TestsAR3; IF Effect = 'TREATMENT' THEN DELETE; IF Effect = 'REPMEASURE' THEN DELETE; IF ProbF > 0.05 Then Reject = 0; Else Reject = 1; /*'Main 



A 

B 

C 

D 

E 

F 

I 

J 

K 

L 

O 

P 

R 

S 

T 

U 

V 

W 


