Dear Chol-hee,

The short answer is that the two model matrices are different and they have
different dimensions; you can verify this by using the dim(mod_mat) to see
the dimension of the model matrix.

Here is my understanding: If you have a factor  f1 with 3 levels and a
factor f2 with 2 levels (where all the possible level combinations exist),
 then f1:f2 is all the combinations of f1 and f2 (an equivalent  factor
with 6 levels) and  the  model matrix ~f1:f2 would have six columns (i.e.
fit a model with 6 coefficients).
However, the model matrix ~f1+f2 will have 4 columns ( i.e. fit 4
coefficients: constant, two for f1 and one for f2).
The model ~f1*f2 will fit 6 coefficients and have a model matrix with the
same column space as the model matrix for ~f1:f2.


I hope this helps,

cheers,
Achilleas


On Tue, Oct 23, 2012 at 10:10 PM, Cholhee Jung <jung.cholhee@gmail.com>wrote:

>
>
>  Dear users,
>
>  Below is the question I posted originally in the 'ComBat user forum' of
> Google group.
>  But, as I was suggested to forward my question to Bioconductor mailing
> list, I'm doing it now.
>
>  Please find my question, below.
>
>
>  Regards,
>  Chol-hee
>
> On Tuesday, October 23, 2012 10:13:26 AM UTC+11, Cholhee Jung wrote:
> >
> >
> >
> >  Dear users,
> >
> >  I was trying ComBat on ~1,000 samples.
> >  Samples are spread over 12 batches and each batch contains 4 technical
> > replicates that are identical across all batches.
> >  The number of covariates is 5, and I was using the ComBat implemented in
> > the 'sva' package.
> >
> >  I tried ComBat with two model matrix built from the same covariate
> > information.
> >
> >  First model matrix was constructed as below:
> >  >mod_mat = model.matrix(~as.factor(cov1) + as.factor(cov2) +
> > as.factor(cov3) + as.factor(cov4) + as.factor(cov5), data=pheno_data )
> >
> >  Second one was built as below:
> >  >mod_mat = model.matrix(~as.factor(paste(pheno_data$cov1,
> > pheno_data$cov2, pheno_data$cov3, pheno_data$cov4, pheno_data$cov5,
> > sep=":")))
> >
> >  Basically, covariates were concatenated into one string for the the
> > second model matrix.
> >
> >  ComBat with the first model matrix raised the 'singular' error like
> below:
> >
> >   Error in solve.default(t(design) %*% design) :
> >    Lapack routine dgesv: system is exactly singular
> >
> >  But, ComBat run without error with the second model matrix.
> >
> >
> >  Now I wonder if the two different model matrices are same?
> >
> >  Regards,
> >  Chol-hee
> >
> >
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

