Wednesday, July 25, 2012

Much more red than you expect is lurking in Apple financial results

At the beginning of March I've written about the possibility that the Apple share price may be reaching inflection point.

This hypotheses was based on the George Soros' Boom-Bust Model.

Since then the previously dynamic growth of Apple stock prices has rather visibly lost steam:

Chart: Apple stock price, 1 year; source:

Yesterday Apple reported its financial results for calendar Q2.

The company performance was pretty solid, overall. But it wasn't stellar as in the past. And the company reported the second consecutive decrease in revenues, that in addition were significantly lower than what analysts expected.

Still, it doesn't mean that Apple's existence is endangered in any way. At least not yet and most probably not in the nearest future.

However, when you take a deeper look on the financial data, you will notice a menacing trend - increasing number of Apple's financial dynamics (1st and 2nd order derivatives) is turning negative:

Spreadsheet: Apple Financials

You may combine that with market dynamics for iOS vs Android.

I wonder whether you can draw any analogies from the experiences of Motorola, Nokia or Research in Motion?

VaR: you cannot estimate the unknown

In previous post I have introduced the concept of Value at Risk (VaR).

I have mentioned that there is (at least) one serious problem with VaR.

This problem stems from the fact, that VaR uses historical data to estimate future risk.

But what if the historical data simply does not contain information allowing predicting the future?

In an earlier post I presented the case of UniWIBID fixed income fund which after 9 years of amazingly stable returns (albeit small - some 2 bps per day), experienced an unprecedented single day 2.7% drop that wiped out six months of gains.
Chart: UniWIBID daily returns from inception (2003-05-22) till the shock (2012-06-04)

As a result of extremely low pre shock volatility, VaR for UniWIBID was totally uninformative till the very last moment.

Based on the probability distribution of historical returns, it seemed not possible UniWIBID could generate loss at either 5% or 1% probability level. A remote chance of an extremely low loss - 0.0064% - was signaled at cumulative 1% level, only.

The probability that the fund will generate return equal to or below 0%, was 0.004403347, or 0.44%.

Chart: VaR and CVaR potential percentage losses based on pre shock historical returns for UniWIBID

Historical UniWIBID returns did not give any way to properly asses the risk of the fund.

UniWIBID returns alone did not tell anything about fund's concentration in particular assets, potential losses on such assets, probability of generating such losses and dependencies (correlations) between assets.

Meanwhile, based on the fund's annual report, close to 6,7% of UniWIBID's assets were invested in bonds of a development group PBG which recently declared insolvency. This means potential losses on PBG debt anywhere between 40% and 100%.

An extremely low probability event, such as bankruptcy of one of the largest companies in Poland which derives much of its revenues from government-financed contracts, that can potentially have a high impact outcome for UniWIBID value is a classic example of a Black Swan. And Black Swan-type risks cannot be properly modeled using VaR.
Chart: UniWIBID daily returns from inception (2003-05-22) till 2012-07-23, including shock on 2012-06-04

Chart: VaR and CVaR potential percentage losses after the shock

Two possible ways of dealing with shortcomings of VaR-type analysis and adjusting for previously absent situations are stress testing and comparative / multivariate analysis.

The first approach depends on proper identification of critical factors affecting the system, their dependencies, scale of possible shocks, as well their potential individual and joint impacts. The key problem here is predicting the unknown.

The second approach assumes similarity in performance of related systems and reversion to the mean (see my previous post "Black Swans and multivariate time series analysis")

[ R source for VaR / CVaR calculations & visualization in R ]

Tuesday, July 24, 2012

Meet two beasts of risk management - VaR and CVaR

Value-at-Risk (VaR) is a commonly used risk measure.

It says what is a minimum amount of money that can be lost over a certain period at a given probability level, based on the historical returns.

So, a daily VaR equal to $100 million at 5% probability, means, there is a 1 in 20 chance of losing $100 million or more in a single future day.

The first important thing about VaR is that it specifies only a minimum amount that can be lost. Hence, virtually any larger loss is possible.

To take this limitation into account, a related measure called Conditional VaR or Expected Shortfall is used.

Conditional VaR says, what is the expected (i.e. average) loss in case the return is among a certain portion (such as 1% or 5%) of the worst historical cases. Therefore CVaR combines both VaR at a certain level and all worst cases, weighted by their probability of occurrence.

Below chart show density of normally distributed returns together with 5% and 1% VaR and CVaR values.
Chart: ND Returns Density together with VaR and CVaR

There is however one serious problem with both VaR and CVaR I'm going to address in the next post.

Monday, July 23, 2012

Calculating Sharpe Ratio and Information Ratio in R

Sharpe Ratio and Information Ratio measure excess returns of an investment manger, fund or strategy in relation either to risk free interest rate or some benchmark (for example such as market index), in the context of their variability (which - partly - reflects their risk).

Fig. Example: some return vs. benchmark return

There is at least one R package already available - PerformanceAnalytics - which provides both Sharpe Ratio and Information Ratio, 

Hence I've written my own simple implementation of these functions. 

You can use these ratios together with drawdown calculations as a basic risk management tools.