make.modeltype | R Documentation |
The helper make.modeltype()
creates a vector that identifies per block if
the imputation model is taken from predictorMatrix
or formulas
. The
function is used internally by mice()
.
make.modeltype(modeltype, predictorMatrix, formulas, priority = "pred")
modeltype |
A character vector of length equal to the number of blocks in |
predictorMatrix |
A matrix specifying the predictors for each block. Each row corresponds to a block, and each column corresponds to a variable. Non-zero entries indicate that the variable is used as a predictor for the block. |
formulas |
A list of formulas, where each element corresponds to a block in |
priority |
A character string specifying the default value for |
A character vector of length equal to the number of rows in predictorMatrix
.
Each element is either "pred"
or "formula"
, indicating how the imputation model
is specified for the corresponding block.
# Example predictorMatrix
predictorMatrix <- matrix(1, nrow = 3, ncol = 3,
dimnames = list(c("block1", "block2", "block3"), c("x1", "x2", "y")))
predictorMatrix[1, 3] <- 0
# Case 1: No modeltype or formulas specified
make.modeltype(NULL, predictorMatrix, NULL)
# Case 2: Formulas provided
formulas <- list(
NULL,
y ~ x1 + x2,
NULL
)
make.modeltype(NULL, predictorMatrix, formulas)
# Case 3: Custom modeltype
modeltype <- c("pred", "formula", "pred")
make.modeltype(modeltype, predictorMatrix, NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.