From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 291/CH10/EX10.5a/eg10_5a.sce | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 291/CH10/EX10.5a/eg10_5a.sce (limited to '291/CH10/EX10.5a/eg10_5a.sce') diff --git a/291/CH10/EX10.5a/eg10_5a.sce b/291/CH10/EX10.5a/eg10_5a.sce new file mode 100755 index 000000000..b0a9fc100 --- /dev/null +++ b/291/CH10/EX10.5a/eg10_5a.sce @@ -0,0 +1,40 @@ +X = [53 35 31 37 40 43; 36 34 17 21 30 18; 47 37 17 31 45 26; 55 31 17 23 43 37; 40 32 19 26 45 37; 52 42 20 27 26 32; 39 28 21 21 36 28; 40 32 21 21 36 35]; +m= 8; +n = 6; +Xidot = zeros(8,1); +for i=1:8 + for j=1:6 + Xidot(i)=Xidot(i) + X(i,j); + end +end +Xidot = Xidot/6; +Xjdot = zeros(6,1); +for j=1:6 + for i=1:8 + Xjdot(j)=Xjdot(j) + X(i,j); + end +end +Xjdot = Xjdot/8; +Xdotdot = sum(Xidot)/8; +new = (Xidot - Xdotdot)^2; +SSr = n*sum(new); +new1 = (Xjdot - Xdotdot)^2; +SSc = m*sum(new1); +SSe = 0; +for i=1:m + for j=1:n + SSe = SSe + (X(i,j)-Xidot(i)-Xjdot(j)+ Xdotdot)^2; + end +end +N =(m-1)*(n-1); +TS1 = SSr*N/((m-1)*SSe); +TS2 = SSc*N/((n-1)*SSe); +pvaluec = 1- cdff("PQ", TS1, m-1, N); +pvaluer = 1- cdff("PQ", TS2, n-1, N); +//disp(pvaluer, pvaluec); +//disp(TS1, TS2); +disp(TS1, "The value of the F-statistic for testing that there is no row effect is"); +disp(pvaluec, "The p-value for testing that there is no row effect is"); + +disp(TS2, "The value of the F-statistic for testing that there is no column effect is"); +disp(pvaluer, "The p-value for testing that there is no column effect is"); -- cgit