home *** CD-ROM | disk | FTP | other *** search
- stanvb(lcx,lcn,nb,nt,ntb,nr,n,x,f,av,g)
-
- /* this function produces the analysis of variance table n and
- the f-ratio for treatments of a square, balanced, incomplete
- block design. the sum of squares is adjusted because of
- incompleteness.
- */
-
- int lcn,lcx,n[],nb,nt,ntb,nr;
- float *f,av[],g[],x[];
-
- {
- int i,j,ijx,ijn,klrn,klrx;
- float an,den,p,s,w,w1,ww1,xb,xl,xn,xt,xtb,xr,xnum,u;
-
- xb = nb;
- xt = nt;
- xtb = ntb;
- xr = nr;
- xnum = nr * (ntb - 1);
- den = nt - 1;
- xl = xnum / den;
- u = 0.;
- w1 = 0.;
- av[0] = 0.;
-
- for(i = 0; i <= nb-1; i++)
- {
- ww1 = 0.;
- ijx = i * lcx;
- ijn = i * lcn;
-
- for(j = 0; j <= nt -1; j++)
- {
- an = n[ijn];
- x[ijx] = x[ijx] * an;
- av[0] = av[0] + x[ijx] * x[ijx];
- ww1 = ww1 + x[ijx];
- ijn = ijn + 1;
- ijx = ijx + 1;
- }
- u = u + ww1;
- g[i] = ww1;
- w1 = w1 + ww1 * ww1;
- }
- av[2] = u * u / (xb * xtb);
- av[7] = w1 / xtb - av[2];
- w = 0.;
- klrn = 0;
- klrx = 0;
-
- for(j = 0; j <= nt-1; j++)
- {
- s = 0.;
- p = 0.;
-
- for(i = 0; i <= nb-1; i++)
- {
- ijn = klrn + i * lcn;
- ijx = klrx + i * lcx;
- xn = n[ijn];
- p = p + xn * g[i];
- s = s + x[ijx];
- }
- w = w + (xtb * s - p) * (xtb * s - p);
- klrn = klrn + 1;
- klrx = klrx + 1;
- }
- av[4] = w / (xtb * xt * xl);
- av[3] = 1.;
- av[5] = nt - 1;
- av[8] = nb - 1;
- av[10] = av[0] - av[7] - av[4] - av[2];
- av[1] = nb * ntb;
- av[11] = av[1] - av[8] -av[5] - 1.;
- av[6] = av[4] / av[5];
- av[9] = 9999.9999;
- av[12] = av[10] / av[11];
- *f = av[4] * av[11] / (av[5] * av[10]);
- }