Categories &

Functions List

Function Reference: ncfpdf

statistics: y = ncfpdf (x, df1, df2, lambda)

Noncentral F-probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the noncentral F-distribution with df1 and df2 degrees of freedom and noncentrality parameter lambda. The size of y is the common size of x, df1, df2, and lambda. A scalar input functions as a constant matrix of the same size as the other inputs.

Further information about the noncentral F-distribution can be found at https://en.wikipedia.org/wiki/Noncentral_F-distribution

See also: ncfcdf, ncfinv, ncfrnd, ncfstat, fpdf

Source Code: ncfpdf

Example: 1

 

 ## Plot various PDFs from the noncentral F distribution
 x = 0:0.01:5;
 y1 = ncfpdf (x, 2, 5, 1);
 y2 = ncfpdf (x, 2, 5, 2);
 y3 = ncfpdf (x, 5, 10, 1);
 y4 = ncfpdf (x, 10, 20, 10);
 plot (x, y1, "-r", x, y2, "-g", x, y3, "-k", x, y4, "-m")
 grid on
 xlim ([0, 5])
 ylim ([0, 0.8])
 legend ({"df1 = 2, df2 = 5, λ = 1", "df1 = 2, df2 = 5, λ = 2", ...
          "df1 = 5, df2 = 10, λ = 1", "df1 = 10, df2 = 20, λ = 10"}, ...
         "location", "northeast")
 title ("Noncentral F PDF")
 xlabel ("values in x")
 ylabel ("density")

                    
plotted figure

Example: 2

 

 ## Compare the noncentral F PDF with LAMBDA = 10 to the F PDF with the
 ## same number of numerator and denominator degrees of freedom (5, 20)

 x = 0.01:0.1:10.01;
 y1 = ncfpdf (x, 5, 20, 10);
 y2 = fpdf (x, 5, 20);
 plot (x, y1, "-", x, y2, "-");
 grid on
 xlim ([0, 10])
 ylim ([0, 0.8])
 legend ({"Noncentral F(5,20,10)", "F(5,20)"}, "location", "northeast")
 title ("Noncentral F vs F PDFs")
 xlabel ("values in x")
 ylabel ("density")

                    
plotted figure