View source: R/EW_ForLion_GLM_Optimal.R
EW_ForLion_GLM_Optimal | R Documentation |
EW ForLion algorithm to find EW D-optimal design for GLM models with mixed factors, reference: . 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.
EW_ForLion_GLM_Optimal(
n.factor,
factor.level,
hfunc,
joint_Func_b,
Lowerbounds,
Upperbounds,
link,
reltol = 1e-05,
rel.diff = 0,
optim_grad = TRUE,
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 |
joint_Func_b |
The prior joint probability distribution of the parameters |
Lowerbounds |
The lower limit of the prior distribution for each parameter |
Upperbounds |
The upper limit of the prior distribution for each parameter |
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 |
optim_grad |
TRUE or FALSE, default is FALSE, whether to use the analytical gradient function or numerical gradient for searching optimal new design point |
maxit |
the maximum number of iterations, default value 100 |
random |
TRUE or FALSE, if TRUE then the function will run EW lift-one with additional "nram" number of random approximate allocation, default to be FALSE |
nram |
when random == TRUE, the function will run EW lift-one nram number of initial proportion p00, default is 3 |
logscale |
TRUE or FALSE, if TRUE then the EW ForLion will run EW lift-one with logscale, which is EW_liftoneDoptimal_log_GLM_func(); if FALSE then ForLion will run EW lift-one without logscale, which is EW_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 EW D-optimal approximate allocation
det Optimal determinant of Fisher information matrix
x.model model matrix X
E_w vector of E_w such that E_w=diag(p*E_w)
convergence TRUE or FALSE
min.diff the minimum Euclidean distance between design points
x.close a pair of design points with minimum distance
#Example Crystallography Experiment
hfunc.temp = function(y) {c(y,1)} # y -> h(y)=(y1,1)
n.factor.temp = c(0) # 1 continuous factors
factor.level.temp = list(c(-1,1))
link.temp="logit"
paras_lowerbound<-c(4,-3)
paras_upperbound<-c(10,3)
gjoint_b<- function(x) {
Func_b<-1/(prod(paras_upperbound-paras_lowerbound))
##the prior distributions are follow uniform distribution
return(Func_b)
}
EW_ForLion_GLM_Optimal(n.factor=n.factor.temp, factor.level=factor.level.temp,
hfunc=hfunc.temp,joint_Func_b=gjoint_b, Lowerbounds=paras_lowerbound,
Upperbounds=paras_upperbound, link=link.temp, reltol=1e-2, rel.diff=0.01,
optim_grad=FALSE, maxit=500, random=FALSE, nram=3, logscale=FALSE,Xini=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.