Contenido principal

nctcdf

Noncentral t cumulative distribution function

Description

p = nctcdf(x,nu,delta) returns the cumulative distribution function (cdf) of the noncentral t distribution with nu degrees of freedom and the noncentrality parameter delta, evaluated at the values in x.

example

p = nctcdf(x,nu,delta,"upper") returns the complement of the noncentral t cdf, evaluated at the values in x, using an algorithm that more accurately computes the extreme upper-tail probabilities as compared to subtracting the lower-tail value from 1.

example

Examples

collapse all

Compute the cumulative distribution function (cdf) values evaluated at the values in x for the noncentral t distribution with 10 degrees of freedom and the noncentrality parameter delta=1. Plot the result together with the cdf of the t distribution with the same number of degrees of freedom.

x = -5:0.1:5;
p1 = nctcdf(x,10,1);
p2 = tcdf(x,10);
plot(x,p1,"b-",x,p2,"r:")
grid on
xlabel("x")
ylabel("p")
legend(["Noncentral t CDF" "t CDF"],Location="southeast")

Figure contains an axes object. The axes object with xlabel x, ylabel p contains 2 objects of type line. These objects represent Noncentral t CDF, t CDF.

Determine the probability of sampling a number greater than 20 from the noncentral t distribution with 99 degrees of freedom and the noncentrality parameter delta = 5. To determine the probability, calculate the probability of sampling a number less than or equal to 20 and subtract result from 1.

p1 = 1 - nctcdf(20,99,5)
p1 = 
0

The probability of sampling a number less than or equal to 20 is so close to 1 that subtracting the result from 1 gives 0.

To approximate the extreme upper-tail probability with greater precision, compute the complement of the noncentral t cdf directly.

p2 = nctcdf(20,99,5,"upper")
p2 = 
1.7247e-20

The output indicates a small probability of sampling a number greater than 20.

Input Arguments

collapse all

Values at which to evaluate the noncentral t cdf, specified as a numeric scalar or an array of numeric scalars.

To evaluate the cdf at multiple values, specify x as an array. To evaluate the cdfs of multiple distributions, specify either nu or delta (or both) using arrays. If one or more of the input arguments x, nu, and delta are arrays, then the array sizes must be the same. In this case, nctcdf expands each scalar input into a constant array of the same size as the array inputs. Each element in p is the cdf value of the distribution specified by the corresponding elements in nu and delta, evaluated at the corresponding element in x.

Data Types: single | double

Degrees of freedom, specified as a positive scalar or an array of positive scalars.

To evaluate the cdf at multiple values, specify x as an array. To evaluate the cdfs of multiple distributions, specify either nu or delta (or both) using arrays. If one or more of the input arguments x, nu, and delta are arrays, then the array sizes must be the same. In this case, nctcdf expands each scalar input into a constant array of the same size as the array inputs. Each element in p is the cdf value of the distribution specified by the corresponding elements in nu and delta, evaluated at the corresponding element in x.

Data Types: single | double

Noncentrality parameter, specified as a numeric scalar or array.

To evaluate the cdf at multiple values, specify x as an array. To evaluate the cdfs of multiple distributions, specify either nu or delta (or both) using arrays. If one or more of the input arguments x, nu, and delta are arrays, then the array sizes must be the same. In this case, nctcdf expands each scalar input into a constant array of the same size as the array inputs. Each element in p is the cdf value of the distribution specified by the corresponding elements in nu and delta, evaluated at the corresponding element in x.

Data Types: single | double

Output Arguments

collapse all

Noncentral t cdf values evaluated at the values in x, returned as a numeric scalar or array. p is the same size as x, nu, and delta after any necessary scalar expansion. Each element in p is the cdf value of the distribution specified by the corresponding elements in nu and delta, evaluated at the corresponding element in x.

Alternative Functionality

  • nctcdf is a function specific to the noncentral t distribution. Statistics and Machine Learning Toolbox™ also offers the generic function cdf, which supports various probability distributions. To use cdf, specify the probability distribution name and its parameters. Note that the distribution-specific function nctcdf is faster than the generic function cdf.

  • Use the Probability Distribution Function Tool to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

References

[1] Evans, M., N. Hastings, and B. Peacock. Statistical Distributions. 2nd ed., Hoboken, NJ: John Wiley & Sons, Inc., 1993, pp. 147–148.

[2] Johnson, N., and S. Kotz. Distributions in Statistics: Continuous Univariate Distributions-2. Hoboken, NJ: John Wiley & Sons, Inc., 1970.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a