bedapub / designit

Blocking and randomization for experimental design
https://bedapub.github.io/designit/
Other
7 stars 1 forks source link

Add optimality/efficiency #31

Open idavydov opened 10 months ago

idavydov commented 10 months ago

TODO:

banfai commented 10 months ago

I'm lost...

https://www.itl.nist.gov/div898/handbook/pri/section5/pri521.htm Table 5.2: D=0.6825575, A=2.2, G=1, I=4.6625

The same design in JMP: D Efficiency 90.3602 G Efficiency 88.88889 A Efficiency 88.88889 Average Variance of Prediction 0.180556

In R with this code:

> d_eff(d)
[1] 72.59794
> a_eff(d)
[1] 67.79659
> g_eff(d)
[1] 94.2809

⬆️ this is wrong, see below

banfai commented 9 months ago
m <- structure(c(-1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, 1, 
1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
1, -1, 1), dim = c(12L, 3L), dimnames = list(NULL, c("X1", "X2", 
"X3")))
d <- as.data.frame(m)
> d_eff(m)
[1] 87.35805
> g_eff(m)
[1] 92.58201
> a_eff(m)
[1] 85.71429
> d_eff(model.matrix(~X1 + X2 + X3, data = d))
[1] 90.3602
> a_eff(model.matrix(~X1 + X2 + X3, data = d))
[1] 88.88889

these are the same as JMP

> g_eff(model.matrix(~X1 + X2 + X3, data = d))
[1] 94.2809

this is not

image

banfai commented 5 days ago

all these optimality criteria are model dependent, and I was using the wrong model (only linear terms), that's why there was a discrepancy between JMP/R and the NIST page

with the correct model (inlcuding X1²) they are the same (at least for D): NIST Table 5.2: D=0.6825575, A=2.2, G=1, I=4.6625

R

> d_eff(model.matrix(~X1 + X2 + X3 + I(X1^2), data = d))
[1] 68.25575
> a_eff(model.matrix(~X1 + X2 + X3 + I(X1^2), data = d))
[1] 45.45455
> g_eff(model.matrix(~X1 + X2 + X3 + I(X1^2), data = d))
[1] 100

JMP image