mice (version 3.11.0)

extend.formulas: Extends formula's with predictor matrix settings

Description

Extends formula's with predictor matrix settings

Usage

extend.formulas(
  formulas,
  data,
  blocks,
  predictorMatrix = NULL,
  auxiliary = TRUE,
  include.intercept = FALSE,
  ...
)

Arguments

formulas

A named list of formula's, or expressions that can be converted into formula's by as.formula. List elements correspond to blocks. The block to which the list element applies is identified by its name, so list names must correspond to block names. The formulas argument is an alternative to the predictorMatrix argument that allows for more flexibility in specifying imputation models, e.g., for specifying interaction terms.

data

A data frame or a matrix containing the incomplete data. Missing values are coded as NA.

blocks

List of vectors with variable names per block. List elements may be named to identify blocks. Variables within a block are imputed by a multivariate imputation method (see method argument). By default each variable is placed into its own block, which is effectively fully conditional specification (FCS) by univariate models (variable-by-variable imputation). Only variables whose names appear in blocks are imputed. The relevant columns in the where matrix are set to FALSE of variables that are not block members. A variable may appear in multiple blocks. In that case, it is effectively re-imputed each time that it is visited.

predictorMatrix

A numeric matrix of length(blocks) rows and ncol(data) columns, containing 0/1 data specifying the set of predictors to be used for each target column. Each row corresponds to a variable block, i.e., a set of variables to be imputed. A value of 1 means that the column variable is used as a predictor for the target block (in the rows). By default, the predictorMatrix is a square matrix of ncol(data) rows and columns with all 1's, except for the diagonal. Note: For two-level imputation models (which have "2l" in their names) other codes (e.g, 2 or -2) are also allowed.

auxiliary

A logical that indicates whether the variables listed in predictors should be added to the formula as main effects. The default is TRUE.

include.intercept

A logical that indicated whether the intercept should be included in the result.

...

Named arguments that are passed down to the univariate imputation functions.

Value

A list of formula's