Create design contrast matrix using automatic function

时间:2016-02-12 20:29:57

标签: r functional-programming compare-contrast

I would like to create a function that return design contrast matrix of factors with number of factors, levels in each factor as input. Im my example, I have:

1st factor

@media only screen and (min-width:768){
    .canvas {
        height: 80px;
    }
}

2nd factor

treat <- gl(3, 20, labels = paste("t", 1:3, sep=""))

create a design matrix of the contrasts for "imp"

imp <- rep(gl(2, 10, labels = c("yes", "no")), 3)

create a design matrix of the contrasts for "treat"

contrasts(imp) <- c(-1, 1)
Imp <- model.matrix(~ imp)[, -1]

Now I ask how I can start for create Imp and Treat matrix and all combination of Imp and Treat, given Factor=2, Levels = c(3,2) and Nsize=60, for example?

0 个答案:

没有答案