Compute and plot the *z*-scores
of two data vectors, and then compare the results.

Load the sample data.

Two variables load into the workspace: `gpa`

and `lsat`

.

Plot both variables on the same axes.

It is difficult to compare these two measures because they are
on a very different scale.

Plot the *z*-scores of `gpa`

and `lsat`

on
the same axes.

Now, you can see the relative performance of individuals with
respect to both their `gpa`

and `lsat`

results.
For example, the third individual's `gpa`

and `lsat`

results
are both one standard deviation below the sample mean. The eleventh
individual's `gpa`

is around the sample mean
but has an `lsat`

score almost 1.25 standard deviations
above the sample average.

Check the mean and standard deviation of the *z*-scores
you created.

ans =
1.0e-14 *
-0.1088 0.0357

By definition, *z*-scores of `gpa`

and `lsat`

have
mean 0 and standard deviation 1.

Load the sample data.

Two variables load into the workspace: `gpa`

and `lsat`

.

Compute the *z*-scores of `gpa`

using
the population formula for standard deviation.

1.2554 1.2128
0.8728 0.8432
-1.2100 -1.1690
-0.2749 -0.2656
1.4679 1.4181
-0.1049 -0.1013
-0.4024 -0.3888
1.4254 1.3771
1.1279 1.0896
0.1502 0.1451
0.1077 0.1040
-1.5076 -1.4565
-1.4226 -1.3743
-0.9125 -0.8815
-0.5724 -0.5530

For a sample from a population, the population standard deviation
formula with *n* in the denominator corresponds to
the maximum likelihood estimate of the population
standard deviation, and might be biased. The sample standard
deviation formula, on the other hand, is the unbiased estimator of
the population standard deviation for a sample.

Compute *z*-scores using the
mean and standard deviation computed along the columns or rows of
a data matrix.

Load the sample data.

The dataset array `flu`

is loaded in the workplace. `flu`

has
52 observations on 11 variables. The first variable contains dates
(in weeks). The other variables contain the flu estimates for different
regions in the U.S.

Convert the dataset array to a data matrix.

The new data matrix, `flu2`

, is a 52-by-10
double data matrix. The rows correspond to the weeks and the columns
correspond to the U.S. regions in the data set array `flu`

.

Standardize the flu estimate for each region (the *columns* of `flu2`

).

You can see the *z*-scores in the variable
editor by double-clicking on the matrix `Z1`

created
in the workspace.

Standardize the flu estimate for each week (the *rows* of `flu2`

).

Return the mean and standard deviation used
to compute the *z*-scores.

Load the sample data.

Two variables load into the workspace: `gpa`

and `lsat`

.

Return the *z*-scores, mean, and standard
deviation of `gpa`

.

Z =
1.2128
0.8432
-1.1690
-0.2656
1.4181
-0.1013
-0.3888
1.3771
1.0896
0.1451
0.1040
-1.4565
-1.3743
-0.8815
-0.5530
gpamean =
3.0947
gpastdev =
0.2435