Displaying 1 result from an estimated 1 matches for "cumusum".
Did you mean:
cumsum
2006 Jan 24
1
Linearize a Function
hi,
i calculate the log-returns in return1 and i want to get the performance for
the security. with only one security i have the following code
# create matrix to keep performance
return100=matrix(rep(100,length(return1)+1))
# matrix for the sum
z1=matrix(rep(0,length(return1)+1))
# suming up the returns from current index to start
for (i in 1:length(return1)) {z1[i+1]=sum(return1[c(1:i)]) }