%% ztest1_for_prop (test program)
%{
We have a trick coin which is claimed to come up heads 70% of the
time. We have made 20 “random” flips and saw only 10 heads.
Should we reject the claim of the toy manufacturer? Use 95% CL.
%}
clear
clc
format compact
%% Two Tail Test
p = 0.70;
p_sample = 0.50;
n = 20;
alpha = 0.05;
[H z pval] = ztest1_for_prop(p, p_sample, n, alpha, 'both')
%% Left Tail Test
clc
p = 0.70;
p_sample = 0.50;
n = 20;
alpha = 0.05;
[H z pval] = ztest1_for_prop(p, p_sample, n, alpha, 'left')
%% Right Tail Test
clc
p = 0.70;
p_sample = 0.50;
n = 20;
alpha = 0.05;
[H z pval] = ztest1_for_prop(p, p_sample, n, alpha, 'right')