Performs random imputation in a vector that contains missing values.
Usage
rand.imput(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).