My apologies if this is a trivial question, but I am having trouble with this for a while now.
I need to use a skew-normal distribution in research in MATLAB and the only way I found after googling was to use Pearsrnd, as given in here.
Now, I did the math and wrote function skewnormal function in MATLAB as follows:
%% The helper function calculating parameters for skew-normal using pearsrnd
function [m,s, sk, kurt] = skewnormal(a, e, w)
c = sqrt(2/pi); % it is used a lot in what follows
d = a/sqrt(1+a*a); % temp variable
m = e + d*w*c; % mean
s = w*sqrt(1 - d^2*c^2); % variance
sk = (4 - pi)/2*(d*c*w/s)^3; % skewness
kurt = 3 + 2*(pi-3)*(d*c*w/s)^4; % kurtosis accounted for the matlab convention.
end
Then, when I use the above in my code and return the type of the Pearsrnd, it returns $1$ - which is apparently Four parameters Beta distribution in Pearsrnd.
I did look for answers here that could immediately answer but I did not find any.
Can anyone fix my attempt at generating Skew-Normal distribution, since I am clearly doing something wrong?
pearsrnd
just drop an e-mail to MathWorks support. These are pretty much bread and butter for them. $\endgroup$