Skip to content

Instantly share code, notes, and snippets.

@mjbommar
Created June 8, 2020 10:23
Show Gist options
  • Save mjbommar/a9f77b245a41945b83bb0aa25abbf2d1 to your computer and use it in GitHub Desktop.
Save mjbommar/a9f77b245a41945b83bb0aa25abbf2d1 to your computer and use it in GitHub Desktop.
% kappa risk measure in pure Matlab
% see also:
% * https://gist.github.com/mjbommar/320298
% * https://gist.github.com/mjbommar/320296
% D : return series vector
% r : return threshold
% n : Kappa order
function k = kappa(D, r, n)
k = (mean(D) - r) ./ nthroot(mean((D < r) .* (r-D).^n), n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment