Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

tcdf - Student's t cumulative distribution function

Syntax

P = tcdf(X,V)

Description

P = tcdf(X,V) computes Student's t cdf at each of the values in X using the corresponding degrees of freedom in V. X and V can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs.

The t cdf is

The result, p, is the probability that a single observation from the t distribution with ν degrees of freedom will fall in the interval [–∞, x).

Examples

mu = 1; % Population mean
sigma = 2; % Population standard deviation
n = 100; % Sample size
x = normrnd(mu,sigma,n,1); % Random sample from population
xbar = mean(x); % Sample mean
s = std(x); % Sample standard deviation
t = (xbar-mu)/(s/sqrt(n)) % t-statistic
t =
    0.2489
p = 1-tcdf(t,n-1) % Probability of larger t-statistic
p =
    0.4020

This probability is the same as the p-value returned by a t-test of the null hypothesis that the sample comes from a normal population with mean μ:

[h,ptest] = ttest(x,mu,0.05,'right')
h =
     0
ptest =
    0.4020

See Also

cdf, tpdf, tinv, tstat, trnd

Student's t Distribution

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS