Search code examples
matlabdistributionquantile

Computing Quantile in MATLAB


Is there any built-in function in MATLAB to compute

0.025th quantile of Binomial distribution with parameter n=60 and p=0.4

0.975 quantile of standard normal distribution ?


Solution

  • Do you have the Statistics toolbox? If yes,

    >> binoinv(.025,60,.4)
    
    ans =
    
        17
    
    >> norminv(.975,0,1)
    
    ans =
    
        1.9600
    

    If not, you could use the following equivalences:

    • The inverse normal CDF can be expressed in terms of the erfinv function
    • The binomial CDF can be expressed in terms of the betainc function