我有6个矩阵,我必须对6个矩阵的单元格值进行t检验,然后将p值存储在新矩阵中
输入: 有6个具有相同维度的输入矩阵 3来自正常组织的输入矩阵:
GeneA GeneB
GeneA 31 4
GeneB 5 8
GeneA GeneB
GeneA 5 14
GeneB 5 8
GeneA GeneB
GeneA 30 14
GeneB 45 7
3癌组织的输入矩阵:
GeneA GeneB
GeneA 11 4
GeneB 5 18
GeneA GeneB
GeneA 7 14
GeneB 15 4
GeneA GeneB
GeneA 30 14
GeneB 45 7
输出:
GeneA GeneB
GeneA t-test({31,5,30},{11,7,13}) t-test({4,14,14},{4,14,14})
GeneB t-test({5,5,45},{5,15,45}) t-test({8,8,7},{18,4,7})
输出矩阵将具有测试中的p值
Input:
There are 6 input matrices of same dimensions
3 input matrices from normal tissues:
GeneA GeneB
GeneA 31 4
GeneB 5 8
GeneA GeneB
GeneA 5 14
GeneB 5 8
GeneA GeneB
GeneA 30 14
GeneB 45 7
3 input matrices from cancer tissues:
GeneA GeneB
GeneA 11 4
GeneB 5 18
GeneA GeneB
GeneA 7 14
GeneB 15 4
GeneA GeneB
GeneA 30 14
GeneB 45 7
output:
GeneA GeneB
GeneA t-test({31,5,30},{11,7,13}) t-test({4,14,14},{4,14,14})
GeneB t-test({5,5,45},{5,15,45}) t-test({8,8,7},{18,4,7})
Output matrix will have the p-values from the test
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
遵循的代码以3-DIM阵列形式对数据进行t检验。这使得循环遍历数据集,提取所需的向量并运行测试变得更加容易。
从表格数据到数组,
t检验
首先创建结果列表,然后运行测试,然后将p值提取到data.frame中。
由
创建
由
The code that follows conducts the t-tests on data in a 3-dim array form. This makes it easier to loop through the data sets, extract the required vectors and run the tests.
From tabular data to arrays
The t-tests
Create a results list first, then run the tests, then extract the p-values into a data.frame.
Created on 2022-06-01 by the reprex package (v2.0.1)
Data
Created on 2022-06-01 by the reprex package (v2.0.1)
也许最简单的方法是将两组矩阵绑定到2 x 2 x 3数组中,然后使用
map
在四个组合中的每一个中获取t测试。假设您的矩阵被称为
norm1
,norm2
,norm3
的常规组织和ca1
,ca2
和CA3
癌组织。然后我们可以做:在2022-06-01创建的 reprex package (v2.0.1)
可重复的数据
Perhaps the neatest way to this is to bind both sets of matrices into 2 x 2 x 3 arrays, then use
Map
to get the t tests at each of the four combinations.Let's say your matrices are called
norm1
,norm2
,norm3
for the normal tissue andca1
,ca2
andca3
for the cancer tissue. Then we can do:Created on 2022-06-01 by the reprex package (v2.0.1)
Reproducible data