**10**wrote:

Hello, I have an expression matrix of 1208 samples (1095 tumor and 113 normal) downloaded from TCGA. I know there are 3 batch effects: type, plateId and TSS. I've tried to correct for them with Combat but I need a little help with the model.matrix.

```
batch<-as.data.frame(cbind(samples,plateId,group,TSS),as.is=T)[,-1]
#correct for group
mod.1<- model.matrix(~plateId+TSS, data=batch)
bat.1<- ComBat(dat=dati, batch$group, mod.1, mean.only = TRUE, par.prior=TRUE, prior.plots=FALSE)
## correct for plateId
mod.2<- model.matrix(~group+TSS, data=batch)
bat.2<- ComBat(dat=bat.1, batch$plateId, mod.2, mean.only = TRUE,par.prior=TRUE, prior.plots=FALSE)
## correct for TSS
mod.3<- model.matrix(~group+plateId, data=batch)
bat.3<- ComBat(dat=bat.2, batch$TSS, mod.3, mean.only = TRUE,par.prior=TRUE, prior.plots=FALSE)
```

There is something wrong. The error message says:

```
Error in ((dat - t(design %*% B.hat))^2) %*% rep(1/n.array, n.array) :
requires numeric/complex matrix/vector arguments
```

Is there anyone who can help me? I'm a student. Thanks in advance.