Hi
I am relatively new to R and have been using an algorithm for a project.
I is in this case about 400 million. It is taking a rather long time to run ~20 - 30 minutes, and I was curious if there was a better way of running this?
dPNProbExpand is a vector of probabilities, 1 row shorter than I. So naturally it should take some time, I was just wondering if this setup is the best.
Thanks in advance
I am relatively new to R and have been using an algorithm for a project.
I is in this case about 400 million. It is taking a rather long time to run ~20 - 30 minutes, and I was curious if there was a better way of running this?
dPNProbExpand is a vector of probabilities, 1 row shorter than I. So naturally it should take some time, I was just wondering if this setup is the best.
Thanks in advance
Code:
I = 400000000
tao = 1
V_b <- matrix(0, I, 1)
V_s <- matrix(0, I, 1)
while( I >= (tao*V)) {
for( j in ((((tao - 1)*V)+1):(tao*V))){
V_b[tao] = V_b[tao] + dPNProbExpand[j]
}
V_s[tao] = (V - V_b[tao])
tao = tao + 1
}