MATLAB Answers

Leo
0

How to calculate returns for each group and different number of observations per group?

Asked by Leo
on 4 Nov 2017
Latest activity Edited by Leo
on 4 Nov 2017

Hello everyone,

I need to calculate daily returns for each company in my dataset. I have different amounts of daily observations per company. How can I calculate those daily returns per company? I tried using splitapply, but to me it seems not to work.

Thanks for your help!!

  2 Comments

key	Date	P
34567	02.01.06	2,2
34567	03.01.06	2,21848
34567	04.01.06	2,2616
34567	05.01.06	2,24488
34567	06.01.06	2,25984
34567	09.01.06	2,2704
34567	10.01.06	2,23872
34567	11.01.06	2,2352
34567	12.01.06	2,22376
34567	13.01.06	2,2264
34567	16.01.06	2,23784
34567	17.01.06	2,2308

My dataset is a times series of stock prices from different companies. My data comprises 5 years of stock prices. The dataset is unbalanced, which means that I have a different amount of observations per company.

Log in to comment.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Win prizes and improve your MATLAB skills

Play today