I'm trying to compute the D-optimal value by hand (on R)
Based on this video
I could get the D value by
library(AlgDesign)
dat <- gen.factorial(3, 2)
mat1 <- model.matrix(~(X1 + X2), dat)
mat2 <- mat1[c(1, 8, 6), ]
det((t(data.matrix( mat2 )) %*% data.matrix(mat2)))
However, when I'm trying to get the D value from this example things go terribly wrong
dat <- gen.factorial(5, 3)
des <- optFederov(~ quad(.), dat, nTrials=15, evaluateI=F)
des$D
mtr <- model.matrix(~ quad(.), des$design)
det((t(data.matrix( mtr )) %*% data.matrix(mtr)))
Any ideas why the process to calculate the D value works in the first example but fails in the second?
