Skip to content

Instantly share code, notes, and snippets.

@mjbommar
Created June 8, 2020 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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