【发布时间】:2011-12-13 09:03:28
【问题描述】:
尝试构建我认为的列联表,请考虑以下几点:
dist = Parallelize[Table[RandomVariate[NormalDistribution[]], {100000}]];
dist2 = Rest@FoldList[0.95 # + #2 &, 0, dist];
dist3 = Rest@FoldList[0.95 # + Abs[#2] &, 0, dist];
dist4 = {dist2, dist3}\[Transpose]
q1 = Flatten[{Quantile[dist2, {1/3, 2/3}], Quantile[dist3, {1/3, 2/3}]}]
{-1.39001, 1.33851, 15.0327, 16.6757}
我需要做什么:对于 dist4 的每个元素,我需要查看它所属的下面的 9 个框:
for example : {1.55191, 15.7189} belongs to 2
1.55 belongs to 1 and
15.71 belongs to 8
So the intersection is 2.
我尝试过 If 或 Switch,但写起来太长了。有自动的方法吗?
【问题讨论】:
-
对了,如果采用my
FoldandFoldListmodification,可以写:dist2 = FoldList[0.95 # + #2 &, dist];
标签: count wolfram-mathematica contingency