Preparing the Data

  1. In case 158, type newCar as the value for model, and for price through mpg, type 21.5, 1.5, 76, 106.3, 67.9, 175, 2.932, 11.9, and 46 as the values.
  2. In case 159, type newTruck as the value for model, and for price through mpg, type 34.2, 3.5, 167, 109.8, 75.2, 188.4, 4.508, 17.2, and 26 as the values.

    Now you need to mark these cases as of particular interest. First, create a focal case identifier. The default output will show information about which vehicles are the "nearest neighbors" to the focal cases.

  3. To create a focal case identifier, from the menus choose:

    Transform > Compute Variable...

  4. Type focal as the name of the target variable.
  5. Type any(model, 'newCar', 'newTruck') as the numeric expression. This sets the value of focal to 1 for "any" case whose value of the variable model is 'newCar' or 'newTruck', and 0 otherwise.
    Figure 1. Compute Variable dialog
    Compute Variable dialog
  6. Click OK.

    Now create a partitioning variable. Specifying that the prototype vehicles are holdouts ensures that they will not be used to create the nearest neighbor model, but will be included in the output.

  7. Recall the Compute Variable dialog.
  8. Type partition as the name of the target variable.
  9. Modify the numeric expression to be 1-any(model, 'newCar', 'newTruck'). This sets the value of partition to 0 for "any" case whose value of the variable model is 'newCar' or 'newTruck', and 1 otherwise.
  10. Click OK.

Next