# Chapter 7 Standardizing

## 7.1 Intro

Standardizing a variable means subtracting its mean from every data point in the data series, and dividing the resulting numbers by the variable’s standard deviation. The result is a variable with a mean of 0 and a standard deviation of 1.

### 7.1.1 Example dataset

This example uses the Rosetta Stats example dataset “pp15” (see Chapter 1 for information about the datasets and Chapter 3 for an explanation of how to load datasets).

### 7.1.2 Variable(s)

From this dataset, this example uses variable xtcUsePillHigh.

## 7.3 Input: R

This stores the standardized values in a variable called xtcUsePillHigh_standardized:

dat$xtcUsePillHigh_standardized <- scale(dat$xtcUsePillHigh);

In R is also easy to center a variable around its mean (i.e. omit the division by the standard deviation from the standardization procedure). The following command stores the centered values in a variable called xtcUsePillHigh_centered:

dat$xtcUsePillHigh_centered <- scale(dat$xtcUsePillHigh, scale = FALSE);

## 7.4 Input: SPSS

This command orders descriptives, but the /SAVE subcommand also saves the standardized values. These are then given the original variable name prepended by Z, so in this case, ZxtcUsePillHigh:

DESCRIPTIVES VARIABLES = xtcUsePillHigh
/SAVE.

## 7.5 Output

Recoding a variable is not an analysis, and as such, does not produce output. You can inspect the newly created variable to ensure it has been created properly.