liftone_MLM | R Documentation |
Unconstrained lift-one algorithm to find D-optimal allocations for MLM
liftone_MLM(
m,
p,
Xi,
J,
beta,
link = "continuation",
Fi.func = Fi_func_MLM,
reltol = 1e-05,
maxit = 500,
w00 = NULL,
random = TRUE,
nram = 3
)
m |
The number of design points; it is usually the number of combinations of all the stratification factors |
p |
The number of parameters in the MLM model |
Xi |
Model matrix, a J by p by m 3D array of predictors for separate response category at all design points(input to determine ppo,npo,po) |
J |
The number of response levels |
beta |
A p*1 vector, parameter coefficients for MLM, the order of beta should be consistent with Xi |
link |
Link function of MLM, default to be "cumulative", options from "continuation", "cumulative", "adjacent", and "baseline" |
Fi.func |
A function for calculating Fisher information at a specific design point, default to be Fi_func_MLM function in the package |
reltol |
The relative convergence tolerance, default value 1e-5 |
maxit |
The maximum number of iterations, default value 500 |
w00 |
Specified initial design proportion; default to be NULL, this will generate a random initial design |
random |
TRUE or FALSE, if TRUE then the function will run with additional "nram" number of random initial points, default to be TRUE |
nram |
When random == TRUE, the function will generate nram number of initial points, default is 3 |
w is the approximate D-optimal design
w0 is the initial design used to get optimal design
Maximum is the maximized |F| value
itmax is the number of iterations
convergence is TRUE or FALSE, if TRUE means the reported design is converged
J = 5 # number of categories, >= 3
p = 12 # number of parameters
m = 8 # number of design points
Xi=rep(0,J*p*m) #J*p*m=5*12*8
dim(Xi)=c(J,p,m)
#design matrix
Xi[,,1] = rbind(c( 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
c( 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0),
c( 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0),
c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0),
c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
Xi[,,2] = rbind(c( 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
c( 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0),
c( 0, 0, 0, 0, 0,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( 0, 0, 0, 0, 0, 0, 1, 3, 1, 0, 0, 0),
c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 1),
c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
Xi[,,8] = rbind(c( 1, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0),
c( 0, 0, 0, 1, 4, 1, 0, 0, 0, 0, 0, 0),
c( 0, 0, 0, 0, 0, 0, 1, 4, 1, 0, 0, 0),
c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 1),
c( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
thetavec = c(-4.047, -0.131, 4.214, -2.225, -0.376, 3.519,
-0.302, -0.237, 2.420, 1.386, -0.120, 1.284)
liftone_MLM(m=m, p=p, Xi=Xi, J=J, beta=thetavec, link = "cumulative",
Fi.func=Fi_func_MLM, reltol=1e-5, maxit=500, w00=NULL, random=TRUE, nram=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.