EW_ForLion_GLM_Optimal: EW ForLion for generalized linear models

View source: R/EW_ForLion_GLM_Optimal.R

EW_ForLion_GLM_OptimalR Documentation

EW ForLion for generalized linear models

Description

EW ForLion algorithm to find EW D-optimal design for GLM models with mixed factors. Reference Section 3 of Lin, Huang, Yang (2025). 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.

Usage

EW_ForLion_GLM_Optimal(
  n.factor,
  factor.level,
  var_names = NULL,
  hfunc,
  Integral_based,
  b_matrix,
  joint_Func_b,
  Lowerbounds,
  Upperbounds,
  xlist_fix = NULL,
  link,
  reltol = 1e-05,
  delta = 0,
  maxit = 100,
  random = FALSE,
  nram = 3,
  logscale = FALSE,
  rowmax = NULL,
  Xini = NULL
)

Arguments

n.factor

vector of numbers of distinct levels, “0” indicating continuous factors that always come first, “2” or more for discrete factors, and “1” not allowed.

factor.level

list of distinct factor levels, “(min, max)” for continuous factors that always come first, finite sets for discrete factors.

var_names

Names for the design factors. Must have the same length asfactor.level. Defaults to "X1", "X2", ...

hfunc

function for generating the corresponding model matrix or predictor vector, given an experimental setting or design point.

Integral_based

TRUE or FALSE, whether or not integral-based EW D-optimality is used, FALSE indicates sample-based EW D-optimality is used.

b_matrix

matrix of bootstrapped or simulated parameter values.

joint_Func_b

prior distribution function of model parameters

Lowerbounds

vector of lower ends of ranges of prior distribution for model parameters.

Upperbounds

vector of upper ends of ranges of prior distribution for model parameters.

xlist_fix

list of discrete factor experimental settings under consideration, default NULL indicating a list of all possible discrete factor experimental settings will be used.

link

link function, default "logit", other links: "probit", "cloglog", "loglog", "cauchit", "log", "identity"

reltol

the relative convergence tolerance, default value 1e-5

delta

relative difference as merging threshold for the merging step, the distance of two points less than delta may be merged, default 0, can be different from delta0 for the initial design.

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, whether or not to run the lift-one step in log-scale, i.e., using EW_liftoneDoptimal_log_GLM_func() or 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 indicating automatically generating an initial list of design points.

Value

m number of design points

x.factor matrix with rows indicating design point

p EW D-optimal approximate allocation

det Optimal determinant of the expected 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

Examples

#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,Integral_based=TRUE,joint_Func_b=gjoint_b, Lowerbounds=paras_lowerbound,
Upperbounds=paras_upperbound, link=link.temp, reltol=1e-4, delta=0.01,
maxit=500, random=FALSE, nram=3, logscale=FALSE,Xini=NULL)

ForLion documentation built on June 28, 2025, 1:09 a.m.