function [obs_crps] = f_CRPS_pwm(preds,y)
    % preds needs to be row vector
    num_samples = length(preds);
    abserr      = mean(abs(preds-y));
    [a,~]       = sort(preds);
    b0          = mean(a);
    b1          = a.*(0:num_samples-1);
    b1          = mean(b1)./num_samples;
    
    obs_crps = abserr + b0 - 2 * b1;
end

