View source: R/design_initial_self.R
design_initial_self | R Documentation |
function to generate random initial design with design points and the approximate allocation
design_initial_self(
k.continuous,
factor.level,
lvec,
uvec,
bvec,
h.func,
link = "continuation",
Fi.func = Fi_MLM_func,
delta = 1e-06,
epsilon = 1e-12,
maxit = 1000
)
k.continuous |
number of continuous variables |
factor.level |
lower, upper limit of continuous variables, and discrete levels of categorical variables, continuous factors come first |
lvec |
lower limit of continuous variables |
uvec |
upper limit of continuous variables |
bvec |
assumed parameter values of beta |
h.func |
function, is used to transfer the design point to model matrix (e.g. add interaction term, add intercept) |
link |
link function, default "continuation", other options "baseline", "adjacent" and "cumulative" |
Fi.func |
function, is used to calculate Fisher inforamtion for a design point - default to be Fi_MLM_func() in the package |
delta |
tuning parameter, the distance threshold, || x_i(0) - x_j(0) || >= delta |
epsilon |
or determining f.det > 0 numerically, f.det <= epsilon will be considered as f.det <= 0 |
maxit |
maximum number of iterations |
X matrix of initial design point
p0 initial random approximate allocation
f.det the determinant of Fisher information matrix for the random initial design
k.continuous.temp=5
link.temp = "cumulative"
n.factor.temp = c(0,0,0,0,0,2) # 1 discrete factor w/ 2 levels + 5 continuous
## Note: Always put continuous factors ahead of discrete factors,
## pay attention to the order of coefficients paring with predictors
lvec.temp = c(-25,-200,-150,-100,0,-1)
uvec.temp = c(25,200,0,0,16,1)
hfunc.temp = function(y){
if(length(y) != 6){stop("Input should have length 6");}
model.mat = matrix(NA, nrow=5, ncol=10, byrow=TRUE)
model.mat[5,]=0
model.mat[1:4,1:4] = diag(4)
model.mat[1:4, 5] =((-1)*y[6])
model.mat[1:4, 6:10] = matrix(((-1)*y[1:5]), nrow=4, ncol=5, byrow=TRUE)
return(model.mat)
}
bvec.temp=c(-1.77994301, -0.05287782, 1.86852211, 2.76330779, -0.94437464, 0.18504420,
-0.01638597, -0.03543202, -0.07060306, 0.10347917)
design_initial_self(k.continuous=k.continuous.temp, factor.level=n.factor.temp, lvec=lvec.temp,
uvec=uvec.temp, bvec=bvec.temp, h.func=hfunc.temp, link=link.temp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.