View source: R/ForLion_GLM_Optimal.R
ForLion_GLM_Optimal | R Documentation |
ForLion algorithm to find D-optimal design for GLM models with mixed factors, reference: Section 4 in Huang, Li, Mandal, Yang (2024). Factors may include discrete factors with finite number of distinct levels and continuous factors with specified interval range (min, max), continuous factors, if any, must serve as main-effects only, allowing merging points that are close enough. Continuous factors first then discrete factors, model parameters should in the same order of factors.
ForLion_GLM_Optimal(
n.factor,
factor.level,
hfunc,
bvec,
link,
reltol = 1e-05,
rel.diff = 0,
maxit = 100,
random = FALSE,
nram = 3,
logscale = FALSE,
rowmax = NULL,
Xini = NULL
)
n.factor |
vector of numbers of distinct levels, "0" indicates continuous factors, "0"s always come first, "2" or above indicates discrete factor, "1" is not allowed |
factor.level |
list of distinct levels, (min, max) for continuous factor, continuous factors first, should be the same order as n.factor |
hfunc |
function for obtaining model matrix h(y) for given design point y, y has to follow the same order as n.factor |
bvec |
assumed parameter values of model parameters beta, same length of h(y) |
link |
link function, default "logit", other links: "probit", "cloglog", "loglog", "cauchit", "log", "identity" |
reltol |
the relative convergence tolerance, default value 1e-5 |
rel.diff |
points with distance less than that will be merged, default value 0 |
maxit |
the maximum number of iterations, default value 100 |
random |
TRUE or FALSE, if TRUE then the function will run lift-one with additional "nram" number of random approximate allocation, default to be FALSE |
nram |
when random == TRUE, the function will run lift-one nram number of initial proportion p00, default is 3 |
logscale |
TRUE or FALSE, if TRUE then the ForLion will run lift-one with logscale, which is liftoneDoptimal_log_GLM_func(); if FALSE then ForLion will run lift-one without logscale, which is liftoneDoptimal_GLM_func() |
rowmax |
maximum number of points in the initial design, default NULL indicates no restriction |
Xini |
initial list of design points, default NULL will generate random initial design points |
m number of design points
x.factor matrix with rows indicating design point
p D-optimal approximate allocation
det Optimal determinant of Fisher information matrix
convergence TRUE or FALSE
min.diff the minimum Euclidean distance between design points
x.close a pair of design points with minimum distance
itmax iteration of the algorithm
#Example 3 in Huang, Li, Mandal, Yang (2024), electrostatic discharge experiment
hfunc.temp = function(y) {c(y,y[4]*y[5],1);}; # y -> h(y)=(y1,y2,y3,y4,y5,y4*y5,1)
n.factor.temp = c(0, 2, 2, 2, 2) # 1 continuous factor with 4 discrete factors
factor.level.temp = list(c(25,45),c(-1,1),c(-1,1),c(-1,1),c(-1,1))
link.temp="logit"
b.temp = c(0.3197169, 1.9740922, -0.1191797, -0.2518067, 0.1970956, 0.3981632, -7.6648090)
ForLion_GLM_Optimal(n.factor=n.factor.temp, factor.level=factor.level.temp, hfunc=hfunc.temp,
bvec=b.temp, link=link.temp, reltol=1e-2, rel.diff=0.03, maxit=500, random=FALSE,
nram=3, logscale=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.