Estimate the parameters of a skewed normal distribution knowing p5, mean and p95

10 views (last 30 days)
I have the p5 (fifth percentile), mean, and p95 of a skewed normal distribution.
How can I estimate the parameters of the distribution so that I could get its cdf?

Answers (1)

Jeff Miller
Jeff Miller on 30 Jul 2019
Here is one script for doing this with Cupid. I don't think you are guaranteed to be able to hit all three targets exactly (not sure about this), and you can re-weight the terms in the error function if you care more about some than others.
% You need reasonable guesses for the values of the parameters, depending on your data.
% Here are some wild guesses:
startingparms = [50,5.4,2.7];
% Use fminsearch to find the best parameters; the error function is below.
% Note that the target values you are searching for are specified inside the error function.
finalparms = fminsearch(@SkewNormErr,startingparms)
% Create a distribution with the final best parameters that fminsearch could find:
skn = SkewNor(finalparms(1),finalparms(2),finalparms(3));
% Check that it gives the desired mean & percentile values.
% These should match the "Known" values in the error function.
skn.InverseCDF(.05)
skn.InverseCDF(.95)
skn.Mean
% Plot its PDF and CDF
skn.PlotDens;
% You can compute PDF(x), CDF(x), and lots of other values from skn,
% as indicated in the Cupid documentation.
function errval = SkewNormErr(parms)
% This is the utility function that fminsearch will use to optimize parameters.
% parms is a vector of the three parameters of the SkewNormal distribution.
% this function will compute an error score summarizing the deviation
% of the values of that distribution from the known Pct05, mean, and Pct95
% Example of known target values.
% You want to search for Skewnormal parameter values
% giving a distribution with these properties.
% Adjust these to whatever values you want.
Known05 = 48;
Known95 = 61;
KnownMean = 54;
skn = SkewNor(parms(1),parms(2),parms(3));
errval = ( Known05-skn.InverseCDF(.05) )^2 + ( Known95-skn.InverseCDF(.95) )^2 ...
+ ( KnownMean-skn.Mean )^2;
end

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!