code: public PCA setProjection(double p) {
          if (p <= 0 || p > 1) {
              throw new IllegalArgumentException("Invalid percentage of variance: " + p);
          }
  
          for (int k = 0; k < n; k++) {
              if (cumulativeProportion[k] >= p) {
                  setProjection(k + 1);
                  break;
              }
          }
  
          return this;
      }
docs: Set the projection matrix with top principal components that contain
  (more than) the given percentage of variance.
  @param p the required percentage of variance.