Problem 3074. Compute the cokurtosis of a given portfolio.

Solution 780215

Submitted on 17 Nov 2015
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
%% rng('default') R = randn(504, 5); w = ones(5, 1)/5; assert(abs(computePortCokurt(R, w)-0.119749008958925)<1e-3)

Inner matrix dimensions must agree.

2   Fail
%% rng('default') R = randn(252, 15); w = ones(15, 1)/15; assert(abs(computePortCokurt(R, w)-0.013012357540290)<1e-3)

Requested 1073741824x1 (8.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See <a href="matlab: helpview([docroot '/matlab/'], 'matlab_env_workspace_prefs')">array size limit</a> or preference panel for more information.

3   Fail
%% rng('default') R = randn(100, 1); w = 1; assert(abs(computePortCokurt(R, w)-6.280759230562035)<1e-3)

Index exceeds matrix dimensions.

4   Fail
%% rng('default') R = randn(5, 10); w = [0.1*ones(5, 1); 0.5; zeros(4, 1)]; assert(abs(computePortCokurt(R, w)-0.169198885214440)<1e-3)

Inner matrix dimensions must agree.