Imputing missing values randomly from uniform or normal distributions

Filling missing values with a random number is often preferable to filling with a constant, such as the mean or median. If the distribution of a variable matches or nearly matches a known distribution, such as a uniform or normal distribution, one can use the functions in Modeler to generate random numbers, given the parameters needed to generate the random numbers.

In this recipe we will impute missing values with random distributions: uniform and normal.

Getting ready

This recipe uses the following files:

  1. Datafile: cup98lrn_variable cleaning random impute recipe.sav
  2. Stream file: Recipe - impute random with known random distribution.str

How to do it...

To impute missing values randomly ...

Get IBM SPSS Modeler Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.