blob: b5488eca122a2021fab71d811217f949c0c60d87 (
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
33
34
35
36
|
x= [60 62 64 65 66 67 68 70 72 74];
y= [63.6 65.2 66 65.5 66.9 67.1 67.4 68.3 70.1 70];
plot2d(x,y,-1);
xbar = mean(x);
ybar= mean(y);
n= 10;
SxY = 0;
for i= 1:n
SxY = SxY + (x(i)*y(i)) - (xbar*ybar);
end
Sxx = 0;
for i=1:n
Sxx= Sxx + (x(i)*x(i)) - (xbar*xbar);
end
SYY = 0;
for i=1:n
SYY = SYY + (y(i)*y(i)) - (ybar*ybar);
end
B = SxY/Sxx;
A = ybar - (B*xbar);
//disp(A, "A is");
//disp(B, "B is");
p= 60:0.1: 72;
q= A + B*p;
plot2d(p,q,2);
SSR = ((Sxx*SYY)- (SxY*SxY))/Sxx ;
ts = sqrt(((n-2)*Sxx)/SSR)*(B-1)
//disp(ts);
tvalue= cdft("T",n-2, 0.99, 0.01 );
//disp(tvalue);
if(ts<(-1*tvalue))
disp("Null hypotheis is rejected at 1% level of significance")
else
disp("Null hypotheis is accepted at 1% level of significance")
end
|