# Perform some statistical analysis on a matrix to get p-values?

Suppose I have the following 12 x 12 matrix called `my_mat` :

0.21 0.9 0.56 0.9 0.22 1.46 9.94 47.61 63.36 65.09 65.21 65.22
1.1 1.09 0.41 1.07 0.44 1.23 12.21 58.51 77.85 79.97 80.13 80.14
1.16 0.62 0.54 0.59 0.58 1.11 12.59 65.26 86.84 89.2 89.38 89.39
0.91 0.62 0.62 0.62 0.67 1.2 6.85 69.4 92.3 94.75 94.96 94.99
0.71 0.67 0.67 0.67 0.72 1.28 7.38 71.7 95.01 97.25 97.55 97.67
0.7 0.7 0.55 0.7 0.75 1.33 7.7 66.97 90.48 92.32 92.55 93.06
0.9 0.56 0.21 0.22 0.22 9.94 1.23 11.74 31.86 33.34 29.71 27.78
1.09 0.41 1.1 0.44 0.44 12.21 1.11 71.7 5 6.32 5.11 4.54
0.62 0.54 1.16 0.58 0.58 7.7 7.7 71.7 1.3 2.42 2.15 1.98
0.62 0.62 0.91 0.67 0.67 1.23 1.23 1.11 0.47 1.75 1.76 1.73
0.67 0.67 0.71 0.72 0.72 1.11 1.11 1.2 0.64 1.86 1.85 1.81

If we plot the matrix as a heatmap, we can see there exists a definite 'hotspot' region, in the upper right quadrant of the data:

``````library(pheatmap)
pheatmap(my_mat)
``````

I'd like some way to express with a p-value that a given square is or is not significantly different than other squares in the matrix.

Is there some way to do this in R? Can I obtain a matrix of p-values by doing this?

Hello,

Without knowing what these squares represent and how you derived them it might be erroneous to want to calculate p-values (also to calculate so many would be of little use as we'd already have quite a lot of possible comparisons)

The square itself is a constant and not like a variable with a meaningful mean, standard deviation, variance etc.

Thanks for the response that does help me understand. This matrix of results is an example of what I'm seeing when I calculate how well two drugs work together - the higher values represent the combination score. The axes are the drug concentrations. So at a particular concentration of Drug1 combined with a particular concentration of Drug2, I get a distinctly high value in the matrix (aka they work very well together at these concentrations). How can I statistically represent this?

I am assuming you have a value for `Drug1` and `Drug2` for each person? Do you have some sort of dependent variable that quantifies the efficacy of those drugs used together?

Yes that's right.
Sample_A = Drug1 (12 concentrations) x Drug2 (12 concentrations).
Repeat for Sample_B, Sample_C, Sample_D.

I average them all into a single matrix based on the % of cells that die (20% for example). Then transform that into a synergy score (how well both drugs perform compared to what you would expect based on each individual drug alone).

So if I get a single cell of the matrix that has a synergy score of 50 (for example), but all other cells of that matrix have scores on the order of ~1-5, that should mean the concentration of Drug1 and Drug2 that give the score of 50 is by far the best.

How could I put a p-value on that cell (containing a score value of 50) ? Saying compared to all other values of the matrix, it is statistically different.

There is a lot more happening here. I really am not entirely sure if you have independence etc given this averaging. I'd also actually need to see your data with transformations in raw. Consider a reprex: FAQ: How to do a minimal reproducible example ( reprex ) for beginners

You wouldn't want to compare a single cell against all other values in the matrix as you'd be running close to 143 tests with that single cell. I am sure there is a field specific approach in how to determine significance or test this. A two independent samples t-test would already make more sense where you compare one group who received a certain dosage against another group who received a different dosage and then work with H0: There is no significant difference and then H1: There is.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.