latin squares (kirk, chapter 8) busi 6480 lecture 7

33
Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Upload: phebe-cross

Post on 05-Jan-2016

226 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Latin Squares(Kirk, chapter 8)

BUSI 6480Lecture 7

Page 2: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7
Page 3: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Example: Number of Combinations of Factor Levels May Be Too Large

Page 4: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Fewer Combinations of Factor Levels Without Bias

Page 5: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Treatment Levels Always Appear Once In Each Row and Column

Page 6: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

)2/(

pSS

SSF

E

Treatments

)1()2(),1(, pppFF

p

jjTreatments p

yy

pSS

12

2

2)(1

TreatmentsColumnsRowsTE SSSSSSSSSS

p

iiRows p

yy

pSS

12

2

2)(1

p

kkColumns p

yy

pSS

12

2

2)(1

p

i

p

j

p

kkjiT p

yy

pSS

12

2

1 1

2)(1

Sums of Squares For One Observation Per Cell(for more than one obs. per cell use Table 8.3-1, p. 326)

Page 7: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Blocks may be Treatments of interest as well

Page 8: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 9: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Model for Latin Square with n Subjects Per Cell

Yijkl = + j + k + l + jkl + i(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.

Page 10: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 11: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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: A B

B A

Page 12: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Examples of Latin Squares 3 x 3 (12 in total). First One is a “Standard” Square.

Page 13: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 14: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Look at Patterns – B always follows A

Page 15: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Completely Balanced Designs Do Not Exist for p=Odd

Page 16: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Computational Example

Page 17: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Initial Computations Using [ ] Notation

[Y] = (Sum of all Y values)^2 /(number of all Y values)

(172)^2 / (2*4*4) = 924.5

[ABCS] = Sum of squares of every subject / one

= (1)^2 + (2)^ 2 + (2)^2 + … + (70^2

= 1160.00

[ABC] = (Sum of squares of total in each cell)/ (number in each cell)

= (3)^2 / 2 + (7)^2 /2 + … + (13)^2 / 2

[A]= (Sum of squares of total in each level of A) / (number of obs in each level of A)

= (22)^2 / (8) + (28)^2 / (8) + (50)^2 / (8) + (72)^2 / (8)

1119

[B] = (Similar to [A])

933.75

[C] = (Similar to [A])

932.25

Page 18: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Set up ANOVA Table with SS below and compute MSs and Fs

Df SSnp^2 -1 SSTO = [ABCS] -[Y]p-1 SSA = [A] - [Y]p-1 SSB = [B] - [Y]p-1 SSC = [C] - [Y](p-1)(p-2) SSRES = [ABC] - [A] - [B] - [C] +2[Y](p^2) (n-1) SSWCELL=[ABCS] - [ABC]((p-1)*(p-2) + (p^2)(n-1) MSRESpooled=(SSRES + SWCELL) / ((p-1)*(p-2) + (p^2)(n-1)

Pooled MSRES is recommended.

Page 19: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

SAS PROC PLAN TO GET RANDOM LATIN SQ DESIGN

DM "Log;Clear;OUT;Clear;" ; options pageno=min nodate formdlim='-';

title 'Latin Square Design'; proc plan 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=( 1 2 3 4 ) random; run; proc print data = myoutput; proc tabulate 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;

Page 20: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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

Page 21: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

Assigning Treatments To Latin Square

Page 22: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 23: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

SAS: Use Proc Glm – Same as for Randomized Block Designs, except there is an additional treatmentNote Tukey option for this example

proc glm 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 ;

Page 24: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

SAS: Proc GLMPower

Use input column format data set. proc glmpower data = LatinSqData; class Treat_a Treat_b Treat_c; model y = Treat_a Treat_b Treat_c; contrast "1 vs 2" Treat_a 1 -1 0; 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.

Page 25: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 26: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 27: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

SAS: Reading In Latin Square DataNeed Two Data Sets

Treat_b ac1 ac2 ac31 1 2 32 2 3 13 3 1 2

c1 c2 c361 49 5252 53 3440 43 36

Actual Data here

Design here

Page 28: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

SAS Statements to Merge Data

PROC IMPORT OUT= WORK.MyData DATAFILE= "D:\Data Example for LatinSq.xls" DBMS=EXCEL2000 REPLACE; RANGE="MyData$"; GETNAMES=Yes; RUN; proc print; PROC IMPORT OUT= WORK.MyDesign DATAFILE= "D:\Data Example for LatinSq.xls" DBMS=EXCEL2000 REPLACE; RANGE="MyDesign$"; GETNAMES=Yes; RUN; Proc print;

data combine; merge MyData MyDesign;

proc print data = Combine;

Page 29: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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

Page 30: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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;

Page 31: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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;

Page 32: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.

Page 33: Latin Squares (Kirk, chapter 8) BUSI 6480 Lecture 7

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.