llbt.fit | R Documentation |
Function to fit an LLBT using an ELIMINATE feature
llbt.fit(y, Xmodel, q, ncat, maxiter = 100)
y |
response, usually counts |
Xmodel |
design matrix |
q |
number of parameters to eliminate (usually number of comparisons times number of subject covariate levels |
ncat |
number of response categories |
maxiter |
maximum number of iterations (default 100) |
Be careful when specifying the design matrix. Since there is no extrinsic aliasing the matrix must have full rank. Usually, one of the design columns for object must be left out.
Reinhold Hatzinger
Hatzinger, R., & Francis, B. (2004). Fitting paired comparison models in R. https://epub.wu.ac.at/id/eprint/740
# fit basic model casewise
mfr <- llbt.design(cemspc, nitems = 6,
objnames = c("lo", "pa", "mi", "sg", "ba", "st"),
casewise = TRUE)
mm <- model.matrix(~ lo+pa+mi+sg+ba + g1, data = mfr)
X <- mm[, -1]
p <- ncol(X)
ncat <- 3
q <- length(levels(mfr$mu)) * length(levels(mfr$CASE))
llbt.fit(mfr$y, X, q, ncat)
# fit the (aggregated) model with one subject covariate
mfr <- llbt.design(cemspc, nitems = 6,
objnames = c("lo", "pa", "mi", "sg", "ba", "st"),
cov.sel = "ENG")
eng <- mfr$ENG
eng <- factor(eng)
mm <- model.matrix(~ lo+pa+mi+sg+ba + g1 + (lo+pa+mi+sg+ba):eng, data = mfr)
X <- mm[, -1]
q <- length(levels(mfr$mu)) * length(levels(eng))
ncat <- 3
llbt.fit(mfr$y, X, q, ncat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.