As input data, you are given a nObs-by-nAssets matrix portRet of return series for assets in a portfolio along with an nAssets-by-1 vector portWeights of portfolio weights. Example:
>> nObs = 504; % Number of observations
>> nAssets = 5; % Number of assets in the portfolio
>> portRet = randn(nObs, nAssets); % Sample portfolio return series
>> portWeights = rand(nAssets, 1);
>> portWeights = portWeights/sum(portWeights); % Portfolio weights are >=0 and sum to 1.
The task is to compute the portfolio cokurtosis , which is a scalar statistic associated with the portfolio. A full description of this statistic, along with sample MATLAB code for computing it, can be found here:
Write a function that accepts portRet and portWeights as input arguments and returns the scalar statistic portCokurt as its output. You can use the code at the website above as a starting point, but try to simplify and shorten it in the spirit of Cody.