340 likes | 665 Views
BUSI 6480 Lecture 7. Latin Squares (Kirk, chapter 8). Example: Number of Combinations of Factor Levels May Be Too Large. Fewer Combinations of Factor Levels Without Bias. Treatment Levels Always Appear Once In Each Row and Column. Sums of Squares For One Observation Per Cell
E N D
BUSI 6480 Lecture 7 Latin Squares(Kirk, chapter 8)
Example: Number of Combinations of Factor Levels May Be Too Large
Sums of Squares For One Observation Per Cell (for more than one obs. per cell use Table 8.3-1, p. 326)
Another Example of a Latin Square Design • Main Factor – Evaluate Perceived Attractiveness of 4 types of Animation on Web Pages • Nuisance Factor 1 – Four Web Designs • Nuisance Factor 2 – Four Color Patterns • Subjects can be assigned to factor level combinations. But note that 4X4X4 = 64. • Two subjects to each combination is 128 for all combinations. • Easier to use a Latin Square with 16X2 = 32 subjects.
Model for Latin Square with n Subjects Per Cell • Yijkl = m + aj + bk + gl + ejkl + ei(jkl) • (i = 1, . . ., n; j = 1, . . . , p; • k = 1, . . . , p; l = 1, . . ., p) • Note: n represents number of obs. per cell. • p is usually used to represent factor levels Looks like a three factor model with only main effects. But not all factor level combinations are observed.
Within-Subjects and Between-Subjects Designs • If Subjects are assigned to each cell, then the design is a between-subjects design. • If Subjects are assigned so that they a subject is tested across the levels of a factor then the design is a within-subject design. This design can also be called a repeated measures design, especially if measurements are repeated over time.
Examples of Latin Squares: 2 x 2 design • Note: 1 could be replaced by the letter A and 2 could be replaced by the letter B. Then, the first design would become:
Examples of Latin Squares 3 x 3 (12 in total). First One is a “Standard” Square.
Critisism: Asymmetric Skill Transfer • A criticism of Latin Squares is that there may be learning effects that may account for significance of factors. • Because of the cyclic ordering of the levels, there is some counterbalancing that helps to mitigate learning effects. • Also, there should be a sufficient time delay between administration of the treatment combinations to offset learning.
Set up ANOVA Table with SS below and compute MSs and Fs Pooled MSRES is recommended.
SAS PROC PLAN TO GET RANDOM LATIN SQ DESIGN • DM "Log;Clear;OUT;Clear;" ; • options pageno=min nodate formdlim='-'; • title 'Latin Square Design'; • procplan seed=37430; • factors rows=4 ordered cols=4 ordered; • treatments tmts=4 cyclic; • output out=myoutput • rows cvals=('Day 1' 'Day 2' 'Day 3' 'Day 4') random • cols cvals=('Lab 1' 'Lab 2' 'Lab 3' 'Lab 4') random • tmts nvals=( 1234 ) random; • run; • procprint data = myoutput; • proctabulate data = myoutput; • class rows cols; • var tmts; • table rows, cols*(tmts*f=6.) / rts=8; /* f controls length of cell for tmts */ • run; /* rts stands for row title space */ • quit;
Output from Proc Plan • Latin Square Design The PLAN Procedure • Plot Factors • Factor Select Levels Order • rows 4 4 Ordered • cols 4 4 Ordered • Treatment Factors • Initial Block • Factor Select Levels Order Increment • tmts 4 4 Cyclic (1 2 3 4) • rows --cols- --tmts- • 1 1 2 3 4 1 2 3 4 • 2 1 2 3 4 2 3 4 1 • 3 1 2 3 4 3 4 1 2 • 4 1 2 3 4 4 1 2 3
SPSS Latin Square • Put Data in usual column format specifying three fixed or random effects. • Select main effects only under Model option. • Usually only the main treatment is selected in doing post hoc multiple comparisons, but other treatments can be selected. • Use Analyze > General Linear Model > Univariate. • Check observed power on Options for power figures.
SAS: Use Proc Glm – Same as for Randomized Block Designs, except there is an additional treatmentNote Tukey option for this example • procglm data=MyLatinSqData; • class Treat_a Treat_c Treat_b; • model y = Treat_a Treat_c Treat_b; • means Treat_a/Tukey; • run; If a treatment, say Treat_c, is random then after model statement insert: random Treat_c ;
SAS: Proc GLMPower • Use input column format data set. • procglmpower data = LatinSqData; • class Treat_a Treat_b Treat_c; • model y = Treat_a Treat_b Treat_c; • contrast "1 vs 2" Treat_a 1 -10; • power stddev = 1.0445 /*Insert sqrt(MSE) or estimate of stddev*/ • ntotal = 32 /*insert sample size*/ • power = .; NOTE: Tang Charts in back of Kirk textbook can be used to obtain approximate power numbers similar to procedure for CRD or RBD models.
Relative Efficiency of Latin Square and Randomized Block Design • RE = • ((dfRES(LS) +1)/(dfRES(LS) +3))* (((p-1)^2 + 3)/((p-1)^2 + 1))* (MSRES(RB) / MSRES(LS)) This formula can be used to determine sample size in LS relative to that of RB similar to the procedure with RB and CRD. Note that MSRES(RB) needs to be estimated by (MSB + (p-1)MSRES(LS)/p) where C would represent the block factor. B and C could be switched depending on which factor represents the block factor in the RBD.
Crossover Design • Crossover designs have features of randomized block and Latin square designs. • Can be thought of as a stacked Latin square design. • As in a Latin square design, each treatment level occurs an equal number of times in each time period. • Effects of two “nuisance” variables – typically blocks and time can be isolated.
SAS: Reading In Latin Square DataNeed Two Data Sets Actual Data here Design here
SAS Statements to Merge Data • PROCIMPORT OUT= WORK.MyData • DATAFILE= "D:\Data Example for LatinSq.xls" • DBMS=EXCEL2000 REPLACE; • RANGE="MyData$"; • GETNAMES=Yes; • RUN; • procprint; • PROCIMPORT OUT= WORK.MyDesign • DATAFILE= "D:\Data Example for LatinSq.xls" • DBMS=EXCEL2000 REPLACE; • RANGE="MyDesign$"; • GETNAMES=Yes; • RUN; • Procprint; • data combine; • merge MyData MyDesign; • procprint data = Combine;
SAS: Output of Merged Data Set Obs c1 c2 c3 Treat_b ac1 ac2 ac3 1 61 49 52 1 1 2 3 2 52 53 34 2 2 3 1 3 40 43 36 3 3 1 2
SAS: Statements to put in column Format. Note use of Arrays because of Do Loop • Data LatinSqData; • set combine; • Array c[3] c1-c3; • Array ac[3] ac1-ac3; • p = 3; • Do I = 1 to p; • y = c[I]; Treat_a = ac[I]; Treat_c = I; output; • End; • Keep y Treat_a Treat_b Treat_c;
SAS: An Alternative Approach to Creating Columns – No Do Loop • data alterColFormatforshortDataSets; • set combine; • y = c1; Treat_c = 1; Treat_a = ac1; output; • y = c2; Treat_c = 2; Treat_a = ac2; output; • y = c3; Treat_c = 3; Treat_a = ac3; output; • Keep y Treat_a Treat_b Treat_c;
For more than one observation per cell • Data MyDesign; • set MyDesign; • n=10; /* number of obs per cell */ • Do i = 1 to n; • output; • end; • Drop n i; The output statement in the Do Loop increases the number of replications in the design.
HW7: Kirk, Ex. 7 Page 357 • Work Parts a, b, c, d, and g. • Reword part g to: Determine the efficiency of the randomized block design relative to the Latin Square. Assume that the blocks for the RBD is factor C. • Assume that the graduate students and the groups with similar subjects with respect to noun recognition are random effects. • In addition, get the power for the contrast between a1 and a2 • Use SPSS.