我有两个向量,a 和 b。见附件。
a
是信号,是概率。
b
是下一个时期的绝对百分比变化。
Signalt <- seq(0, 1, 0.05)
我想找到在Signalt
a 向量的每个中间 5%-tile ( ) 内出现的最大绝对回报。所以如果是
0.01, 0.02, 0.03, 0.06 0.07
那么它应该计算之间的最大回报
0.01 and 0.02,
0.01 and 0.03,
0.02 and 0.03.
然后继续
0.06 and 0.07 do it over etc.
当整个序列运行时,输出将被合并到一个矩阵或表格中。
它应该遵循向量 a 和 b 的索引。
i
是一个索引,每次a
跨越一个新的百分位时都会更新一个。是与第交叉t(i)
关联的桶。i
a
是长度为 tao 的概率向量。这个向量应该在其 5% 的瓦片中进行分析,最大的中间绝对回报是输出。下一周期的价格变化是向量b
。这将在下面的等式中由 P 表示。
l
并且m
是索引。
每次 Signal 从一个 5% 的块移动到另一个时,我们计算任何两个中间桶之间发生的最大绝对回报,直到 Signal 移动到另一个 5% 的块。例如,假设 Signal 移动到第 85 个百分位,而 4 个音量桶后来移动到第 90 个百分位。然后,我们将计算存储桶 1 和 2、1 和 3、1 和 4、2 和 3、2 和 4、3 和 4 之间的绝对回报。我们对最大绝对回报感兴趣。然后,我们将计算下一个百分位桶中的最大回报,继续下一个,这可能是第 85 个百分位,依此类推。所以我们让 i 是一个索引,每次 Signal 从一个百分位移动到另一个百分位时,它都会更新 1,并且 τ(i) 与第 i 个交叉关联的桶。
这是我正在使用的等式。符号可能略有不同。
现在我的问题是如何去做。也许有人对此有一个直观的解决方案。我希望我的问题很清楚。
"a","b"
0,0.013013698630137
0,0.0013522650439487
0,0.00135409614082593
0,0.00203389830508471
0.27804813511593,0.00135317997293627
0.300237801284318,0
0.495965075167796,0.00405405405405412
0.523741892051237,0.000672947510094168
0.558753750296458,0.00202020202020203
0.665762829019002,0.000672043010752743
0.493106479913899,0.000671591672263272
0.344592579573497,0.000672043010752854
0.336263897823707,0.00201748486886366
0.35884763774257,0.00536912751677865
0.23662807979007,0.00133511348464632
0.212636893966841,0.00267379679144386
0.362212830513403,0.000666666666666593
0.319216408413927,0.00333555703802535
0.277670854167344,0
0.310143323100971,0
0.374104373036218,0.00267737617135211
0.190943075221511,0.00268456375838921
0.165770070508112,0.00200803212851386
0.240310208616952,0.00133600534402145
0.212418038918236,0.00200133422281523
0.204282022136019,0.00200534759358306
0.363725074298064,0.000667111407605114
0.451807761954326,0.000666666666666593
0.369296011692801,0.000666222518321047
0.37503495989363,0.0026666666666666
0.323386355686901,0.00132978723404265
0.189216171830472,0.00266311584553924
0.185252052821193,0.00199203187250996
0.174882909380997,0.000662690523525522
0.149291525540782,0.00132625994694946
0.196824215268048,0.00264900662251666
0.164611993131396,0.000660501981505912
0.125470998266484,0.00132187706543285
0.179999532586703,0.00264026402640272
0.368749638521621,0.000658327847267826
0.427799340926225,0