a****m 发帖数: 693 | 1 比如说,一个5X5 matrix,
里面有7个1, 8个-1, 其余的为0,
matlab里面有不同的distribution random generator, 但是没有上面说的。
谢谢 | r*****o 发帖数: 140 | 2 这个似乎有点难度。
不过我看你的ID,你是不是试图模拟基因组数据?如果这样,你不仿试试HapGen,可以
模拟给定LD和MAF的SNP数据,既然有0,1,2,自然也不难得到-1,0,1 | l*********s 发帖数: 5409 | 3 just call randperm then cast the vector into a matrix | a****m 发帖数: 693 | 4 谢谢各位,
是关于random network, 1, -1 0 represent activate inact, no effect.
randperm 仅仅产生一个区间的数,但是没法控制多少个1 -1和0?
3x | y*****y 发帖数: 98 | 5 the mechanism of randomness is unclear from your statement. it looks like a
discrete graphical model. zero entries of precision matrix correspond to the
conditional independence. | l*********s 发帖数: 5409 | 6 randperm gives you permutation,not a number. and that is all you need.
【在 a****m 的大作中提到】 : 谢谢各位, : 是关于random network, 1, -1 0 represent activate inact, no effect. : randperm 仅仅产生一个区间的数,但是没法控制多少个1 -1和0? : 3x
| hs 发帖数: 1549 | 7 reshape(randperm(5*5),5,5)
然后把最小的n个变成-1,最大的m个变成+1,其它变成0
【在 a****m 的大作中提到】 : 谢谢各位, : 是关于random network, 1, -1 0 represent activate inact, no effect. : randperm 仅仅产生一个区间的数,但是没法控制多少个1 -1和0? : 3x
| a****m 发帖数: 693 | 8 You Guys Rock. Thank you to everyone for your smart thinking! | l**********9 发帖数: 148 | 9 根据不同的语言有不同的写法吧,我想到的算法:
1.生成一个5*5的全0矩阵a。
2.用随机数生成器生成7组数据[ai,bi],i=1,2,...7.其中ai,bi均为整数且属于[1,5]。
3.将a中的a[ai,bi]替换为1.
4.同样的方法生成8个-1位置并替换,位置不能与之前的1重叠。
5.完成
如果没有现成的函数用这个方法也行吧,如果根据矩阵秩的不同1和-1的数量也不同的
话就得再改进了>_< |
|