how do i create and calculate a covariance matrix? how do you get the covariance
4 views (last 30 days)
Show older comments
GeneA = [1.1 0.5 27 1.4 1.9 2.6 3.2 8.1 4.1 0.4 9.4 13 14.1 9.1 18.2 2.1 5.3 16.4 7 21.1 0.3 7.5 17.1 5.2 13.1]; GeneB = [11.4 2.7 3.2 4.4 1.4 6.8 2.2 23.6 21.9 10.2 14.7 9.1 3.3 6.1 10.2 4.8 6.6 2.8 8 5.7 0.2 8.0 8.8 11.5 4.2]; GeneC = [0.7 0.1 13.4 0.9 1.4 1.1 1.5 3.1 1.4 0.4 3.7 8.5 9.1 2.9 7.8 0.9 3.6 6.4 3.1 9.4 0.01 3.2 10.1 3.2 5.4]; GeneD = [21.5 14.3 1.1 9 13.6 12.3 12.8 11.1 2.6 2.1 2.9 4.6 7.1 2.4 3.6 11.7 18.3 25.3 15.2 2.6 6.2 6.1 3.3 15.0 7.1]; GeneE = [0.7 0.1 12.7 0.7 1.1 1.1 1.2 6.2 3.0 0.2 4.1 7.3 7.2 5.1 9.0 0.8 2.2 6.9 3.1 10.9 0.2 5.4 9.1 3.0 6.0]; (5 marks)
2. Our first step is to do the higher dimensional equivalent of centering our data on the origin. Calculate the mean measurement for each gene and create a new 5x25 component matrix to contain the measurements from the matrix above after subtracting, on each row, the mean measurement for each gene. (5 marks)
3. Instead of calculating the axis with the greatest variance manually, there is a mathematical cheat that we can use that makes this process much easier. However, first we much calculate an object called the covariance matrix. The variance for a single set of measurements, x, is defined to be ???(?) = ∑ (??−?̅) 2 ?−1 ? ?=1 where ?̅is the mean of the set of measurements. The covariance between two sets of measurements, x and y, is defined to be ???(?, ?) = ∑ (??−?̅)(??−?̅) ?−1 ? ?=1 where ?̅and ?̅ are the mean measurement from x and y, respectively. Create and calculate the values for a 5x5 matrix where the (i, j) component contains the covariance of the set of measurements from row i with the set of measurements from row j.
0 Comments
Answers (0)
See Also
Categories
Find more on Computational Geometry in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!