I do not understand how the returns are calculated

1 visualización (últimos 30 días)
alessandro caserta
alessandro caserta el 11 de Nov. de 2014
Comentada: Guillaume el 11 de Nov. de 2014
Good morning everyone
I can not understand how they are calculated returns in this part of the code. r4 is the total return vector
series = prices
title(['Final Return = ',num2str(sum(r4),3),' (',num2str(sum(r4)/mean(series2(1,:))*100,3),'%)'])
specifically I do not understand what is the percentage
(',num2str(sum(r4)/mean(series2(1,:))*100,3),'%)'])
thank you so much for your time and cooperation
regards

Respuesta aceptada

Guillaume
Guillaume el 11 de Nov. de 2014
A much clearer way of writing the exact same code would have been to use sprintf:
title(sprintf('Final Return = %.3f (%.3f%%)', sum(r4), sum(r4)/mean(series2(1, :))*100));
Each %.3f in the sprintf is replaced by the numbers that follow the string, in order. To write a % sign in the string, you need to escape it, hence the %%.
It basically writes a title like: 'Final Return = 12.200 (15.750%)' assuming a sum of 12.2 and sum/mean of .1575.
  2 comentarios
alessandro caserta
alessandro caserta el 11 de Nov. de 2014
thank you very much for your quick response. I still have a little doubt. I do not understand what is your 15.750%, in the sense return / average price what expresses? thanks again regards
Guillaume
Guillaume el 11 de Nov. de 2014
Well it's the sum of r4 expressed as a percentage of the average (mean) of the first column of series2. Whether or not it means anything, only you can tell.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Stochastic Differential Equation (SDE) Models en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by