-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathZstar1.m
executable file
·43 lines (39 loc) · 1.05 KB
/
Zstar1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function stars = Zstar(Z, onesided)
% function stars = Zstar(Z)
% Coded by Elmar Mertens, [email protected]
if nargin < 2
onesided = false;
end
if onesided
% Note: keeping the abs to allow for answering whether difference is
% significantly negative or positive
if abs(Z) > norminv(0.99, 0, 1)
stars = '^{\ast\ast}';
elseif abs(Z) > norminv(0.95, 0, 1)
stars = '^{\ast}';
% elseif abs(Z) > norminv(0.9, 0, 1)
% stars = '^{\ast}';
else
stars = '';
end
else
if abs(Z) > norminv(0.995, 0, 1)
stars = '^{\ast}';
elseif abs(Z) > norminv(0.975, 0, 1)
stars = '^{\ast}';
% elseif abs(Z) > norminv(0.95, 0, 1)
% stars = '^{\ast}';
else
stars = '';
end
end
% same code, using MATLAB stats toolbox
% if abs(Z) > norminv(0.995)
% stars = '^{\ast\ast\ast}';
% elseif abs(Z) > norminv(0.975)
% stars = '^{\ast\ast}';
% elseif abs(Z) > norminv(0.95, 0, 1)
% stars = '^{\ast}';
% else
% stars = '';
% end