function ztest not found in R2015a

Dear all,
when searching for ztest in R2015a I cannot find it. Does anyone know how can I add it? I did the same for ttest getting the same issue.
Regards,
Gilly

 Accepted Answer

The core MATLAB functions erfc and erfcinv can emulate the normal probability distributions:
P = @(z) erfc(-z/sqrt(2))/2; % Equivalent to ‘normcdf’
CV = @(alpha) -sqrt(2) * erfcinv(2*alpha); % Equivalent to ‘norminv’
and the t-distribution is a one-line anonymous function:
tdist2T = @(t,v) (1-betainc(v/(v+t^2),v/2,0.5)); % 2-tailed t-distribution
tdist1T = @(t,v) 1-(1-tdist2T(t,v))/2; % 1-tailed t-distribution
where ‘t’ is the t-statistic and ‘v’ the degrees-of-freedom.

2 Comments

Thanks a lot for your help! Much appreciate it!
My pleasure!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!