[BioC] heatmap.2 Z scores

James W. MacDonald jmacdon at med.umich.edu
Thu Oct 8 18:09:19 CEST 2009


Hi Tom,

Thomas Hampton wrote:
> When you use the scaling capabilities of heatmap.2, the
> resulting plot heatmap shows a legend that says
> 
> "Column Z scores" or
> 
> "Row Z scores".
> 
> The scaling looks as though the values have been normalized
> to SD units.
> 
> z = (x - mean)/sd
> 
> Is this what heatmap.2 means by a Z score?

Yes. From the code for heatmap.2():

if (scale == "row") {
         retval$rowMeans <- rm <- rowMeans(x, na.rm = na.rm)
         x <- sweep(x, 1, rm)
         retval$rowSDs <- sx <- apply(x, 1, sd, na.rm = na.rm)
         x <- sweep(x, 1, sx, "/")
     }
     else if (scale == "column") {
         retval$colMeans <- rm <- colMeans(x, na.rm = na.rm)
         x <- sweep(x, 2, rm)
         retval$colSDs <- sx <- apply(x, 2, sd, na.rm = na.rm)
         x <- sweep(x, 2, sx, "/")
     }

> 
> I am finding it tricky to reproduce their results using
> the z value above.

What are you doing to reproduce the values?

Best,

Jim


> 
> 
> Best,
> 
> Tom
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: 
> http://news.gmane.org/gmane.science.biology.informatics.conductor

-- 
James W. MacDonald, M.S.
Biostatistician
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826



More information about the Bioconductor mailing list