Categories &

Functions List

Function Reference: nctcdf

statistics: p = nctcdf (x, df, mu)
statistics: p = nctcdf (x, df, mu, "upper")

Noncentral t-cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the noncentral t-distribution with df degrees of freedom and noncentrality parameter mu. The size of p is the common size of x, df, and mu. A scalar input functions as a constant matrix of the same size as the other inputs.

p = nctcdf (x, df, mu, "upper") computes the upper tail probability of the noncentral t-distribution with parameters df and mu, at the values in x.

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

See also: nctinv, nctpdf, nctrnd, nctstat, tcdf

Source Code: nctcdf

Example: 1

 

 ## Plot various CDFs from the noncentral Τ distribution
 x = -5:0.01:5;
 p1 = nctcdf (x, 1, 0);
 p2 = nctcdf (x, 4, 0);
 p3 = nctcdf (x, 1, 2);
 p4 = nctcdf (x, 4, 2);
 plot (x, p1, "-r", x, p2, "-g", x, p3, "-k", x, p4, "-m")
 grid on
 xlim ([-5, 5])
 legend ({"df = 1, μ = 0", "df = 4, μ = 0", ...
          "df = 1, μ = 2", "df = 4, μ = 2"}, "location", "southeast")
 title ("Noncentral Τ CDF")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure

Example: 2

 

 ## Compare the noncentral T CDF with MU = 1 to the T CDF
 ## with the same number of degrees of freedom (10).

 x = -5:0.1:5;
 p1 = nctcdf (x, 10, 1);
 p2 = tcdf (x, 10);
 plot (x, p1, "-", x, p2, "-")
 grid on
 xlim ([-5, 5])
 legend ({"Noncentral T(10,1)", "T(10)"}, "location", "southeast")
 title ("Noncentral T vs T CDFs")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure