mice.impute.weighted.pmm: Imputation by Weighted Predictive Mean Matching

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mice.impute.weighted.pmm.R

Description

Imputation by predictive mean matching using sampling weights.

Usage

1
2
mice.impute.weighted.pmm(y, ry, x, imputationWeights = NULL, 
      pls.facs = NULL, interactions = NULL, quadratics = NULL, ...)

Arguments

y

Incomplete data vector of length n

ry

Vector of missing data pattern (FALSE – missing, TRUE – observed)

x

Matrix (n x p) of complete covariates.

imputationWeights

Optional vector of sampling weights

pls.facs

Number of factors in PLS regression (if used). The default is NULL which means that no PLS regression is used for dimension reduction.

interactions

Optional vector of variables for which interactions should be created

quadratics

Optional vector of variables which should also be included as quadratic effects.

...

Further arguments to be passed

Value

A vector of length nmis=sum(!ry) with imputed values.

Author(s)

Alexander Robitzsch

See Also

For imputation with the linear normal regression and sampling weights see mice.impute.weighted.norm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
#############################################################################
# EXAMPLE 1: Imputation using sample weights
#############################################################################
	
data( data.ma01)
set.seed(977)

# select subsample
dat <- as.matrix(data.ma01)
dat <- dat[ 1:1000 , ]

# empty imputation
imp0 <- mice::mice( dat , m=0 , maxit=0)

# redefine imputation methods
meth <- imp0$method
meth[ meth == "pmm"  ] <- "weighted.pmm"
meth[ c("paredu" , "books" , "migrant" ) ] <- "weighted.norm"
# redefine predictor matrix
pm <- imp0$predictorMatrix
pm[ , 1:3 ] <- 0
# do imputation
imp <- mice::mice( dat , predictorMatrix=pm , imputationMethod=meth , 
           imputationWeights= dat[,"studwgt"] , m=3 , maxit=5)

## End(Not run)

miceadds documentation built on June 20, 2017, 9:10 a.m.

Search within the miceadds package
Search all R packages, documentation and source code