A Brief Tip on Generating Fractional Factorial Designs in R
[This article was first published on Engaging Market Research, and kindly contributed to Rbloggers]. (You can report issue about the content on this page here)
Want to share your content on Rbloggers? click here if you have a blog, or here if you don't.
Want to share your content on Rbloggers? click here if you have a blog, or here if you don't.
A number of marketing researchers use the orthoplan procedure in SPSS to generate fractional factorial designs. It is not surprising, then, that I received a number of questions concerning the recent article in the Journal of Statistical Software by Hideo Aizaki on “Basic Functions for Supporting an Implementation of Choice Experiments in R.” To summarize their issues, why doesn’t it work like orthoplan in SPSS, and can you answer in 300 words or less? Actually, I added the 300 words or less comment since “moaning when I started to go into detail” sounds worst.
For example, say that you wanted to generate a fractional design for five factors with the following levels: 4x4x3x3x2. The simplest syntax for orthoplan might be “orthoplan factors = a(1,2,3,4), b(1,2,3,4), c(1,2,3), d(1,2,3), e(1,2).” And, SPSS would generate 16 different combinations of the orthogonal maineffects design (aka fractional factorial).
So, you go to the above article, copy the example, and change the code to conform to your example.
# Package
library(“support.CEs”)
# Example 1: Unlabeled Design
rotation.design(attribute.names = list(
A = 1:4,
B = 1:4,
C = 1:3,
D = 1:3,
E = 1:2),
nalternatives = 2, nblocks = 1, row.renames = FALSE,
randomize = TRUE, seed = 987)
des1
We seem to need more code, but not that bad. However, this code will generate the full factorial design with 288 combinations. What happened to the fractional design with 16 combinations?
It’s a long story about how orthoplan works, but I will get to the bottom line. You should change the two 3level factors to 4level factors and rerun the code with the following two changes: C = 1:4 and D = 1:4. You will get your 16 combinations. Now simply recode all the 4’s to 3’s for C and D, and you have your orthoplanlike design in less than 300 words. The designs before and after the coding look like this:
before recoding

after recoding


A

B

C

D

E

A

B

C

D

E


1

4

3

2

1

1

4

3

2

1

1


2

3

2

4

1

2

3

2

3

1

2


3

1

3

4

2

2

1

3

3

2

2


4

4

1

3

2

2

4

1

3

2

2


5

2

4

3

1

2

2

4

3

1

2


6

3

3

3

3

1

3

3

3

3

1


7

1

2

3

4

1

1

2

3

3

1


8

4

4

4

4

1

4

4

3

3

1


9

3

4

1

2

1

3

4

1

2

1


10

4

2

1

3

2

4

2

1

3

2


11

2

2

2

2

1

2

2

2

2

1


12

2

1

4

3

1

2

1

3

3

1


13

1

1

1

1

1

1

1

1

1

1


14

2

3

1

4

2

2

3

1

3

2


15

3

1

2

4

2

3

1

2

3

2


16

1

4

2

3

2

1

4

2

3

2

To leave a comment for the author, please follow the link and comment on their blog: Engaging Market Research.
Rbloggers.com offers daily email updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/datascience job.
Want to share your content on Rbloggers? click here if you have a blog, or here if you don't.