blob: 1f4820594b1d5e138b27dd70a86f3f33c22ea17c (
plain)
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
|
//Caption: One-Sample Tests
//One-sample Sign Test for small samples
//Example9.2
//Page313
//Test 2: Ho: p =1/2, H1: p< 1/2
clear;
clc;
n = 8;//sample size
p =0.5;
q = 1-p;
alpha = 0.05;//significance level
plus_signs = 2;
minus_signs = 7;
//The binomial probability that the number of plus signs <=2
X =2;
[P,Q]=cdfbin("PQ",X,n,p,q);
disp(P,'The binomial probability that the number of plus signs P(X<=2)=')
if (P>alpha) then
disp('Sine it is greater than significance level, the binomial statistic falls')
disp('in the acceptance region')
else
disp('Since it is less than significance level, the binomial statistic falls')
disp('in the rejection region and the null hypothesis should be rejected')
end
//Result
//The binomial probability that the number of plus signs P(X<=2)=
//
// 0.1445313
//
// Sine it is greater than significance level, the binomial statistic falls
//
// in the acceptance region
|