Skip to main content

Exercises

Exercises

Exercise 1

Let \(X\) be centred with \(n\) rows and \(p\) columns, and let \(X = U S V^\top\).

  1. Show that \(\Phi = V\) diagonalizes \(\hat\Sigma = \frac{1}{n-1}X^\top X\), and give the eigenvalues in terms of the singular values.
  2. Show that \(Z = US\).
  3. Show that the reconstruction from all components, \(Z\Phi^\top\), gives back \(X\) exactly.

Exercise 2

Answer with a short justification.

  1. The loadings \(\phi_1\) and \(-\phi_1\) describe the same component. Why.
  2. Two data sets differ only in the units of one column. Do they have the same principal components.
  3. We add a constant to every entry of one column. Do the principal components change.
  4. Can the proportion of variance explained by the first component be smaller than \(1/p\).

Exercise 3

A colleague shows you a t-SNE plot and says three things. For each one, say whether it is justified.

  1. These two clusters are far apart, so the two cell types are very different.
  2. This cluster is larger, so there are more cells of that type.
  3. These points are next to each other, so they are similar.

Exercise 4

PCA on the wine data.

  1. Load it and standardize the 13 measurements.
  2. Make a scree plot and decide how many components to keep.
  3. Make a biplot of the first two components. Which variables are correlated.
  4. Colour the points by the true class. Do the classes separate.
  5. Repeat everything without standardizing. What changes, and why.