home *** CD-ROM | disk | FTP | other *** search
- stanvr(lcx,nt,nb,x,ft,fb,av)
-
- /* this function computes the analysis of variance table and */
- /* f-ratios for treatments and blocks of a randomized complete */
- /* block design. */
-
- int lcx,nb,nt;
- float *ft,*fb,av[],x[];
-
- {
- int i,ij,j;
- float b,c,r,sumx,sumr2,sumc2,t;
-
- sumx = 0.;
- av[0] = 0.;
- sumr2 = 0.;
- sumc2 = 0.;
-
- for(i = 0; i<= nb-1; i++)
- {
- r = 0.;
- ij = i * lcx;
-
- for(j = 0; j <= nt-1; j++)
- {
- av[0] = av[0] + x[ij] * x[ij];
- r = r + x[ij];
- ij = ij + 1;
- }
- sumx = sumx + r;
- sumr2 = sumr2 + r * r;
- }
-
- for(i = 0; i <= nt-1; i++)
- {
- c = 0.;
- ij = i;
-
- for(j = 0; j <= nb-1; j++)
- {
- ij = i + (j * lcx);
- c = c + x[ij];
- }
- sumc2 = sumc2 + c * c;
- }
- av[1] = nb * nt;
- av[2] = sumx * sumx / av[1];
- av[3] = 1.;
- av[4] = sumc2 / nb - av[2];
- av[5] = nt - 1;
- av[6] = av[4] / av[5];
- av[7] = sumr2 / nt - av[2];
- av[8] = nb - 1;
- av[9] = av[7] / av[8];
- av[10] = av[0] - av[7] - av[4] - av[2];
- av[11] = av[5] * av[8];
- av[12] = av[10] / av[11];
- *ft = av[4] / (av[5] * av[12]);
- *fb = av[7] / (av[8] * av[12]);
- }