Processing math: 100%
+ - 0:00:00
Notes for current slide
Notes for next slide

Design and Analysis of Experiments Using R

Latin Square Design

Olga Lyashevska

2022-11-09

1 / 33

This week: Latin Square Design

2 / 33

Block factors

One block factor:

  • RCB - Randomised Complete Block (all treatments are assigned exactly once within each block) and the like:
    • GCB - Generalised Complete Block
    • RCBF - Randomised Complete Block Factorial Design

Two block factors:

  • LSD - Latin Square Design (2 blocking variables)
3 / 33

Comparison

In Latin square each treatment level occurs only once in each row and once in each column (similar to sudoku!)

4 / 33

Latin Square Design

Randomised Complete Block design allow us to block on a single source of variation in the responses.

There are experimental situations with more than one source of extraneous variation.

In these situations we use Latin Square Design.

It require that the numbers of levels of both blocking factors be the same as (or a multiple of) the number of treatments.

5 / 33

Statistical Model

The model for an LSD is written:

yijk=μ+αi+τj+βk+ϵijk

where yijk is the observation in the i-th row ad k-th column

μ is the overall mean

αi the i-th row blocking factor,

τj is the j-th treatment effect,

βk is the k-th column blocking factor

ϵijk is the random error.

6 / 33

Analysis of variance

The analysis of variance consists of partitioning the total sum of squares of the N observations into components for rows, columns, treatments, and error, for example,

SST=SSRows+SSColumns+SSTreatments+SSE

7 / 33

Common uses

One of the common uses for a Latin Square arises when a sequence of treatments is given to a subject over several time periods.

We need to block on subjects, because each subject tends to respond differently.

We also need to block on time period, because there may be consistent differences over time due to growth, aging, disease progression, or other factors.

8 / 33

Bioequivalence of drug delivery

Consider the blood concentration of a drug after the drug has been administered. The concentration will typically start at zero, increase to some maximum level as the drug gets into the bloodstream, and then decrease back to zero as the drug is metabolized or excreted.

These time-concentration curves may differ if the drug is delivered in a different form, say a tablet versus a capsule.

Bioequivalence studies seek to determine if different drug delivery systems have similar biological effects.

9 / 33

Example

We wish to compare 3 methods for delivering a drug:

  • a solution
  • a tablet
  • a capsule

The response will be the area under the time-concentration curve. We anticipate large subject to subject differences, so we block on subject.

11 / 33

Example (cont.)

There are 3 subjects, and each subject will be given the drug 3 times, once with each of the 3 methods.

Because the body may adapt to the drug in some way, each drug will be used once in the first period, once in the second period, and once in the third period.

We anticipate large differences, so we block on period.

12 / 33

Example (cont.)

Area under the curve for administering a drug via:

  • A: solution
  • B: tablet
  • C: capsule

Table entries are treatments and responses.

This is a 3x3 design.

13 / 33

Spreadsheet representation

Download data: right click --> Save link as

14 / 33

R example

# clean working space
rm(list = ls(all = TRUE))
# read in dataset
bioequiv <- read.csv("../datasets/bioequiv.csv")
# explore
str(bioequiv)
## 'data.frame': 9 obs. of 4 variables:
## $ Period : int 1 1 1 2 2 2 3 3 3
## $ Subject : int 1 2 3 1 2 3 1 2 3
## $ Method : chr "A" "C" "B" "C" ...
## $ Response: int 1799 2075 1396 1846 1156 868 2147 1777 2291
15 / 33

Code variables as factors

# change to factors
bioequiv$Period <- as.factor(bioequiv$Period)
bioequiv$Subject <- as.factor(bioequiv$Subject)
bioequiv$Method <- as.factor(bioequiv$Method)
str(bioequiv)
## 'data.frame': 9 obs. of 4 variables:
## $ Period : Factor w/ 3 levels "1","2","3": 1 1 1 2 2 2 3 3 3
## $ Subject : Factor w/ 3 levels "1","2","3": 1 2 3 1 2 3 1 2 3
## $ Method : Factor w/ 3 levels "A","B","C": 1 3 2 3 2 1 2 1 3
## $ Response: int 1799 2075 1396 1846 1156 868 2147 1777 2291
16 / 33

Analysis of variance

# analysis of variance
mod <- lm(Response~Period+Subject+Method, bioequiv)
anova(mod)
## Analysis of Variance Table
##
## Response: Response
## Df Sum Sq Mean Sq F value Pr(>F)
## Period 2 928006 464003 103.231 0.009594 **
## Subject 2 261115 130557 29.047 0.033282 *
## Method 2 608891 304445 67.733 0.014549 *
## Residuals 2 8990 4495
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
17 / 33

Analysis of variance

# the ame result can be achieved via
summary(aov(Response~Period+Subject+Method, bioequiv))
## Df Sum Sq Mean Sq F value Pr(>F)
## Period 2 928006 464003 103.23 0.00959 **
## Subject 2 261115 130557 29.05 0.03328 *
## Method 2 608891 304445 67.73 0.01455 *
## Residuals 2 8990 4495
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
18 / 33

Significant differences

The ANOVA table suggest that there is a significant variation in Response due to Period, Subject and Method.

It does not hovewer identify the specific pairs of Methods which differ.

Questions:

  • Do all methods of drug administration differ?
  • Some of them?

To find significant differences, you must use post hoc tests.

19 / 33

Comparison of means: LSD test

LSD: Fisher's Least Significant Difference

It requires a significant F-test for the equality of all k means before individual paired differences may be tested.

This test helps to identify the populations whose means are statistically different.

The basic idea of the test is to compare the populations taken in pairs.

It is then used to proceed in a one-way or two-way analysis of variance.

20 / 33

Comparison of means: LSD test

# install.packages("agricolae")
library(agricolae)
# help(package="agricolae")
test1 <- LSD.test(y = lm(Response~Period+Subject+Method, bioequiv),
trt = "Method",
group=FALSE)
21 / 33

Comparison of means: LSD test

test1$comparison
## difference pvalue signif. LCL UCL
## A - B -85.0000 0.2607 -320.5292 150.5292
## A - C -589.3333 0.0085 ** -824.8625 -353.8041
## B - C -504.3333 0.0116 * -739.8625 -268.8041

A difference between pair of means A - C and B - C is significant, whereas a diference between A - B is not significant.

Hence, we conclude that (A) solution and (B) tablet result in the same bioequivalence.

22 / 33

Comparison of means: TukeyHSD

Tukey HSD: Honestly Significant Difference Test

Corrects for the Type I error (incorrectly rejecting a true null hypothesis).

Note, that LSD test does not correct.

Both test are used only for comparing of unstructured treatments (not appropriate if treatments correspond to k levels of a quantitative factor).

23 / 33

Comparison of means: TukeyHSD

test2 <- TukeyHSD(aov(Response~Period+Subject+Method, bioequiv), "Method", ordered=TRUE)
test2
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## factor levels have been ordered
##
## Fit: aov(formula = Response ~ Period + Subject + Method, data = bioequiv)
##
## $Method
## diff lwr upr p adj
## B-A 85.0000 -237.4625 407.4625 0.4303453
## C-A 589.3333 266.8708 911.7959 0.0155165
## C-B 504.3333 181.8708 826.7959 0.0210673

Same conclusions as with LSD test. Note, that p-values are higher. This test is more conservative.

24 / 33

Plot Tukey HSD

plot(test2)

25 / 33

Post-hoc tests assumptions

  1. The observations being tested are independent within and among the groups.
  2. The groups associated with each mean in the test are normally distributed.
  3. There is equal within-group variance across the groups associated with each mean in the test (homogeneity of variance).
26 / 33

Type I and Type II error

A statistically significant result cannot prove that a research hypothesis is correct (as this implies 100% certainty). Because a p-value is based on probabilities, there is always a chance of making an incorrect conclusion regarding accepting or rejecting the null hypothesis (H0).

Anytime we make a decision using statistics there are four possible outcomes, with two representing correct decisions and two representing errors.

27 / 33

Create Latin Square Design

library(agricolae)
treatments<-c(LETTERS[1:5])
design <- design.lsd(treatments, seed = 23)$book
levels(design$row) <- paste("Day", rep(1:5))
levels(design$col) <- paste("Lab", rep(1:5))
head(design)
## plots row col treatments
## 1 101 Day 1 Lab 1 A
## 2 102 Day 1 Lab 2 D
## 3 103 Day 1 Lab 3 B
## 4 104 Day 1 Lab 4 C
## 5 105 Day 1 Lab 5 E
## 6 201 Day 2 Lab 1 D
29 / 33

Subsetting dataframes

Lets remove columns plots

Delete column by name:

design1 <- subset(design, select=-c(plots))
drop <-c("plots")
design2 <- design[,!(names(design) %in% drop)]
# see ?"%in%"

Drop column by column index numbers

design3 <-design[-c(1)]
30 / 33

Subsetting dataframes

We can also choose to keep columns instead of dropping.

design4 <- design[c("row", "col", "treatments")]
design5 <- design[c(2:4)]
design6 <- subset(design, select=c(row, col, treatments))

Verify that all options give identical result.

31 / 33

Replication

A design based on a single Latin Square has equal number of columns and rows, which may not always be adequate for an analysis of the treatment effects.

One way of increasing the number of observations is to stack squares one above the other, or next to each other.

32 / 33

Conclusion

Latin Square design helps to increase the precision in detecting differences among treatments by adjusting for variability in experimental units in two ways (rows and columns).

However, the restriction on Latin Square designs is that the number of levels of the row blocking factor, the number of levels of the column blocking factor, and the number of levels of the treatment factor all have to be equal.

This restriction may be impractical in some situations.

33 / 33

This week: Latin Square Design

2 / 33
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow