Orthoplan in R (fractional factorial design)

I am trying to create a factorial design in R for collaborative analysis (e.g. SPOP orthoplan).

Searching through past Stackoverflow questions, I found this previous answer:

How to create fractional factorial design in R?

This is a really helpful answer, but only if you have numerical level factors.

This is unfortunately not my business, because the factors that I want to use are a nominal variable, that is, their levels are not numeric, but the type of factor: for example, I have to deal with a factor indicating the color of a product, which may be green, yellow or red.

I've tried modifying the code suggested as an answer to the question How to create fractional factorial design in R?  thus:

f.design <- gen.factorial(levels.design,factors="all")

      

but the result is not balanced or orthogonal. Moreover, you must define the exact number of probes in the optFederov function. In this answer, the suggested number of trials was:

nTrials=sum(levels.design) 

      

but in order to have a balanced design solution with nominal coefficients, I expect it to be at least:

nTrials=prod(unique(levels.design))

      

Anyway, the package that can deal with such a problem is the package of FrF2

Professor Ulrike Gromping, but it only handles dichotomous variables and I can't figure out how to use it to solve my problem.

+3


source to share


1 answer


After researching the answer for a while, I can share what I found:

yes, you can build orthogonal structures in R, similar to how you do in SPOP orthoplan.

Just define a variable nlevels

as a vector containing the levels of your variables.

Then you have to call:

library(DoE.base)

fract.design <- oa.design(nlevels=levels.design)



The function will search the library of orthogonal structures (exactly Kuhfeld W., 2009, Orthogonal array)

If there is no suitable orthogonal construct available, the function will simply return the full factorial construct (and therefore you will have no other choice in R, but to call the optFederov function, as explained above in my question).

As an example, try:

oa.design(nlevels=c(2,2,3))

oa.design(nlevels=c(2,2,4))

The first has no solution (so you get the full factorial), but the second has a solution, 8 maps, orthogonal and balanced design.

+4


source







All Articles