This is what the data looks like:
‘Return’
10%
-30%
0
2.3%
….
How to calculate accumulated return which equals ‘(1+10%)(1-30%)(1+0)(1+2.3%)(1+…)(1+…)…’
THANKS!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m going to assume that you have some kind of an array, which looks as below. Then the following bit of code would work.
The key is the prod function, which will multiply all values in the vector. Also, remember that
returnis a keyword, and can’t be used as a variable name.