This preview shows pages 1–3. Sign up to view the full content.

H * ‘ Ashley Foradory 2009 * L H * BME341 ê 383J: Computational Genomics Lab * L H * Lab 3: Two - Way Data Matrix Centering by Arithmetic Means * L H * General Commands * L Off @ General:: "spell" D ; Off @ General:: "spell1" D ; H * Center Rows First and Columns Second * L H * Create a 2 μ 2 Matrix * L matrix = 88 a, b < , 8 c, d << ; 8 genes, arrays < = Dimensions @ matrix D TableForm @ matrix D 8 2, 2 < a b c d H * Center Each Row by Its Arithmetic Mean * L Do @ matrix @@ k DD = matrix @@ k DD - Table @ Mean @ matrix @@ k DDD , 8 l, 1, arrays <D , 8 k, 1, genes <D TableForm @ matrix D a + 1 2 H - a - b L 1 2 H - a - b L + b c + 1 2 H - c - d L 1 2 H - c - d L + d H * Center Each Column by Its Arithmetic Mean * L matrix = Transpose @ matrix D ; Do @ matrix @@ k DD = matrix @@ k DD - Table @ Mean @ matrix @@ k DDD , 8 l, 1, genes <D , 8 k, 1, arrays <D matrix = Transpose @ matrix D ; TableForm @ matrix D a + 1 2 H - a - b L + 1 2 I - a + a + b 2 - c + c + d 2 M 1 2 H - a - b L + b + 1 2 I - b + a + b 2 - d + c + d 2 M c + 1 2 H - c - d L + 1 2 I - a + a + b 2 - c + c + d 2 M 1 2 H - c - d L + d + 1 2 I - b + a + b 2 - d + c + d 2 M matrix1 = matrix;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
H * 1. Show that the rows are still centered, even after the centering of the columns. * L The code below that outputs zeros shows the rows and columns are still centered. Table @ Simplify @ Mean @ matrix @@ k DDDD , 8 k, 1, genes <D 8 0, 0 < ?Simplify Simplify @ expr D performs a sequence of algebraic and other transformations on expr , and returns the simplest form it finds. Simplify
This is the end of the preview. Sign up to access the rest of the document.