For the purposes of MPT, to compute return of an asset, one typically uses the daily log return of the assets and then anualizes it and the same goes for stddev
mean = mean(daily log returns)*252
stddev = stddev(daily log returns)*sqrt(252)
Now, I've several years worth of data. So I also compute this in a different way as well to compare:
I compute the annual return for each year separately (i.e., non overlapping, calendar year)
annual return = (P365 - P1)/P1
And then the mean
mean = mean(annual returns for each year)
stddev = stddev(annual returns)
Now, when I compare the restults from these two, there seems to be large differences. For instance, I get a (mean, stddev) of (13%, 26%) by the first method compared to (22%, 52%) in the second method. Doing an exp(mean) in the first method to compare the results doesn't make much of a difference.
In code:
First method:
In [2294]: np.log(t2.a.pct_change()+1).mean()*252
Out[2294]: 0.13256313708025944
In [2295]: np.exp(np.log(t2.a.pct_change()+1).mean()*252)
Out[2295]: 1.1417511006444343
In [2296]: np.log(t2.a.pct_change()+1).std()*np.sqrt(252)
Out[2296]: 0.2666418976278336
Second method:
In [2299]: t2.a.groupby(t2.a.index.year).apply(lambda x:(x[-1] - x[0])/x[0]).mean()
Out[2299]: 0.2223071697039014
In [2300]: t2.a.groupby(t2.a.index.year).apply(lambda x:(x[-1] - x[0])/x[0]).std()
Out[2300]: 0.5251807718593228
Question: Are we likely to see such large differences between annualized returns and the annual returns...esp the volatility part? Or am I going wrong somewhere?
Thank you for your time.