Vector-Input-Friendly Kappa MEX Function
I'd mentioned earlier today that I've rewritten the Matlab MEX Kappa function to take vector inputs for return threshold and Kappa order, and so I've decided to provide it freely as well. As an example, here's a usage with the adjusted log-return distribution of the S&P 500 tracker SPY.
>> spy = price2ret(fts2mat(fund{spyID}.ts.Adj));
>> kappaCX(spy, -0.02:0.01:0.02, 1:3)
ans =
65.3488 8.4319 0.0157 -0.9023 -0.9839
9.7243 2.3936 0.0079 -0.6870 -0.8741
4.4595 1.3934 0.0056 -0.5720 -0.7959You can obtain the new Kappa Ratio function here.
This has obvious advantages over the past methods when one desires a range of Kappa values over thresholds and returns, as memory usage and calculation expense can be dramatically minimized knowing this in advance. With each Kappa curve in a row, the transpose of the resulting matrix is also perfectly suited to Matlab's plot function.
The example above yields the Omega, Sortino, and Kappa-3 values at 5 return thresholds in less than five-thousandths of a second on an average modern laptop computer. Based on a few quick parameter sweeps, I have estimated on a Core Duo T5450 that there is a constant time per element of the return matrix of just under 2.1 ten-thousandths of a second, meaning that for N return thresholds and M Kappa orders, you should get an upper bound on run time with M*N*2.1*10e-4. This constant time should obviously vary with hardware, but these results show that this function is well-suited to high-precision Monte Carlo simulations on estimated parameter distributions.
- Michael J Bommarito II's blog
- Add new comment
- 561 reads
Similar entries
- Calculating the Kappa Function: Matlab MEX Code
- Volatility Arbitrage via Kurtosis Implied by Correlation over Kappa Ratio Difference Surfaces
- Omega, Sortino, and Kappa: How to Calculate in One Line
- Using the Omega Ratio for Asset Allocation on the Select SPDR ETFs
- Best Weighted ETF and CEF Omega Measures
Recent comments
7 weeks 2 days ago
8 weeks 3 days ago
8 weeks 3 days ago
17 weeks 15 hours ago
21 weeks 3 days ago
21 weeks 4 days ago
24 weeks 1 day ago
24 weeks 2 days ago
25 weeks 8 hours ago
26 weeks 3 days ago