**320**wrote:

Hi,

I have an experiment that contains 3 treatments and a technical effect consisting of three batches.

treatment <- c("a","a","a","b","b","b","c","c","c") batch <-c("i","ii","iii","i","ii","iii","i","ii","iii")

I realise that looks like a paired sample design, it's just for simplicity.

design <- model.matrix(~0 + as.factor(treatment) + as.factor(batch))

When I run the above code, I get a design matrix with 5 column names, all three of my treatments, then only two of my batches. I'm not sure why this is happening, I assumed that because I've added zero at the beginning of my model design, that stops terms from being absorbed into the intercept, can anyone shed any light on why I'm only seeing 5 terms?

I realise I could add in the batch as an "extra" variable using:

design <- model.matrix(~0 + as.factor(treatment), as.factor(batch))

but ultimately, I'd like to include multiple variables that could account for technical variation.

Cheers

**50k**• written 4.0 years ago by andrew.j.skelton73 •

**320**