Categories &

Functions List

Function Reference: normcdf

statistics: p = normcdf (x)
statistics: p = normcdf (x, mu)
statistics: p = normcdf (x, mu, sigma)
statistics: p = normcdf (…, "upper")
statistics: [p, plo, pup] = normcdf (x, mu, sigma, pcov)
statistics: [p, plo, pup] = normcdf (x, mu, sigma, pcov, alpha)
statistics: [p, plo, pup] = normcdf (…, "upper")

Normal cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the normal distribution with mean mu and standard deviation sigma. The size of p is the common size of x, mu and sigma. A scalar input functions as a constant matrix of the same size as the other inputs.

Default values are mu = 0, sigma = 1.

When called with three output arguments, i.e. [p, plo, pup], normcdf computes the confidence bounds for p when the input parameters mu and sigma are estimates. In such case, pcov, a 2×2 matrix containing the covariance matrix of the estimated parameters, is necessary. Optionally, alpha, which has a default value of 0.05, specifies the 100 * (1 - alpha) percent confidence bounds. plo and pup are arrays of the same size as p containing the lower and upper confidence bounds.

[…] = normcdf (…, "upper") computes the upper tail probability of the normal distribution with parameters mu and sigma, at the values in x. This can be used to compute a right-tailed p-value. To compute a two-tailed p-value, use 2 * normcdf (-abs (x), mu, sigma).

Further information about the normal distribution can be found at https://en.wikipedia.org/wiki/Normal_distribution

See also: norminv, normpdf, normrnd, normfit, normlike, normstat

Source Code: normcdf

Example: 1

 

 ## Plot various CDFs from the normal distribution
 x = -5:0.01:5;
 p1 = normcdf (x, 0, 0.5);
 p2 = normcdf (x, 0, 1);
 p3 = normcdf (x, 0, 2);
 p4 = normcdf (x, -2, 0.8);
 plot (x, p1, "-b", x, p2, "-g", x, p3, "-r", x, p4, "-c")
 grid on
 xlim ([-5, 5])
 legend ({"μ = 0, σ = 0.5", "μ = 0, σ = 1", ...
          "μ = 0, σ = 2", "μ = -2, σ = 0.8"}, "location", "southeast")
 title ("Normal CDF")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure