SciencesPo (version 1.3.8)

imputation: Simple Random Imputation

Description

Performs random imputation in a vector containing missing values.

Usage

imputation(x)

Arguments

x
a vector whose missing values (NA) is to be replaced.

encoding

UTF-8

Details

Indeed a very simple but somewhat limited approach is to impute missing values from observed ones chosen randomly with replacement (MCAR), assuming that $$p(R|Z_{obs}, Z_{mis}) = p(R|\phi)$$. Sampling with replacement is important since it continues to favor values with higher incidence (preserving the MCAR empirical distribution). It may also be combined with apply for matrix imputation drills, but keep in mind that it is experimental (actually, I wrote this for teaching purposes).

Examples

Run this code
x <- c(1,2,NA,4,5,NA)
imputation(x)

Run the code above in your browser using DataLab