. This is Dataplot program file YATESGEN.DP
. Purpose--Generate ranked list of effects for general 2-level design
. (that is, not necessarily in Yates order)
. Input k = number of factors
. n = number of runs
. Y = response variable
. X1 = factor 1
. X2 = factor 2
. ...
. Xk = factor k
. Output--
. tag = cell name ID if this were a full factorial in n runs
. coef = effect estimates
. Sub-macros needed--call digit.dp
.
. -----start point-----
.
. -----Step 1--Carry out a (full factorial) Yates analysis
. for these n observations-----
. Note--the Yates command is being used here below only as a quick
. way to generate all possible Yates-order tags.
. (the resulting Yates coefficients are not used at all).
.
yates y
skip 0
read dpst1f.dat tag
. print tag
.
. -----Step 2--Compute effect estimates-----
.
let numtag = number tag
loop for j = 1 1 numtag
let posint = tag(j)
call digit.dp
let prod = ^sdigit
let ymeanp(j) = mean y subset prod +1
let ymeanm(j) = mean y subset prod -1
end loop
.
. -----Step 3--Order the effect estimates
. and carry Yates order cell names-----
.
let coef = ymeanp - ymeanm
let coef2 = abs(coef)
let coef2 = -coef2
let coef3 = sortc coef2 coef tag
. print tag ymeanp ymeanm coef
.
.-----Step 4--Compute residual SD-----
.
let ybar = mean y
let pred = ybar*(y-y+1)
let numtagm1 = numtag-1
let p = 1
loop for j = 1 1 numtagm1
let coefj = coef(j)
let posint = tag(j)
call digit.dp
let termj = ^sdigit
let pred = pred+0.5*coefj*termj
let res = y-pred
let res2 = res*res
let sumres2 = sum res2
let p = p+1
let ratio = sumres2/(n-p)
let rsd = sqrt(ratio)
let cumrsd(j) = rsd
end loop
let cumrsd(numtag) = 0