# The logistic model with second-order predictors x1, x2 in [-1,1]
# discretized into 21 points and theta0=c(1, 2, 2, -1, -1.5, 1.5)
form.quad <- ~ x1 + x2 + I(x1*x2) + I(x1^2) + I(x2^2)
Fx <- Fx_glm(form.quad, c(1, 2, 2, -1, -1.5, 1.5),
glm.model="bin-logit", n.levels=c(21,21))
# The locally D-optimal approximate design
w <- od_REX(Fx)$w.best
Fx.lin <- Fx_cube(form.quad, n.levels=c(21,21)) # Just for the plot
od_plot(Fx, w, Fx.lin[, 2:3], dd.size=2)
if (FALSE) {
#The GLM with Poisson link and 2 linear predictors x1,x2 in [-1,1]
# discretized into 21 points and theta0=c(0,2,2)
Fx <- Fx_glm(~x1+x2, c(0, 2, 2), glm.model="Poisson-log", n.levels=c(21, 21))
# The locally D-optimal exact design of size 50 without replications
w <- od_KL(Fx, 50, bin=TRUE, t.max=5)$w.best
Fx.lin <- Fx_cube(~x1+x2, n.levels=c(21, 21))
od_plot(Fx, w, Fx.lin[, 2:3], w.lim=Inf)
}
Run the code above in your browser using DataLab