Resources

Optimal Design in Presence of Covariance

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: OPTEX10                                             */
 /*   TITLE: Optimal Design in Presence of Covariance            */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Optimal Designs,                                    */
 /*   PROCS: IML OPTEX                                           */
 /*    DATA:                                                     */
 /*                                                              */
 /*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
 /*          First Edition, Volume 1 and Volume 2                */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

 options ps=60;

 proc iml;
    blks = int(((1:28)`-1)/4) + 1;
    z = j(28,1) || designf(blks);

    r = toeplitz(0.1**(0:3));
    v = r;
    do i = 2 to 7; v = block(v,r); end;

    iv = inv(v);
    a = ginv(iv-iv*z*inv(z`*iv*z)*z`*iv);
    create A from a;
    append from a;
 quit;

 data fert; do f = 1 to 7; output; end;
 proc optex data=fert seed=56672 coding=orth noprint;
    class f;
    model f;
    block covar=A var=(col1-col28);
    output out=nbd;
 run;

 proc iml;
     use nbd;
     read all var {f};
     nbd = shape(f,7,4);
     print nbd [format=2.];
 quit;