make.predictorMatrix: Creates a 'predictorMatrix' argument

View source: R/predictorMatrix.R

make.predictorMatrixR Documentation

Creates a predictorMatrix argument

Description

This helper function creates a valid predictMatrix. The predictorMatrix is an argument to the mice function. It specifies the target variable or block in the rows, and the predictor variables on the columns. An entry of 0 means that the column variable is NOT used to impute the row variable or block. A nonzero value indicates that it is used.

Usage

make.predictorMatrix(data, blocks = make.blocks(data), predictorMatrix = NULL)

Arguments

data

A data.frame with the source data

blocks

An optional specification for blocks of variables in the rows. The default assigns each variable in its own block.

predictorMatrix

A predictor matrix from which rows with the same names are copied into the output predictor matrix.

Value

A matrix

See Also

make.blocks

Examples

make.predictorMatrix(nhanes)
make.predictorMatrix(nhanes, blocks = make.blocks(nhanes, "collect"))

mice documentation built on June 7, 2023, 5:38 p.m.