// According to the vegan-FAQ.pdf, the scaling factor for scores
// is (notice that L&L 1998 says in p. 586 that such scaling
// doesn"t affect the interpretation of a biplot):
pc_ids = ["RDA%d"%(i+1) for i in range(len(eigenvalues))]
eigvals = pd.Series(eigenvalues, index=pc_ids)
const = np.sum(eigenvalues**2)**0.25
if scaling == 1:
scaling_factor = const
elif scaling == 2:
scaling_factor = eigenvalues / const
feature_scores = np.hstack((U, U_res)) * scaling_factor
sample_scores = np.hstack((F, F_res)) / scaling_factor
feature_scores = pd.DataFrame(feature_scores,
index=feature_ids,
columns=pc_ids)
sample_scores = pd.DataFrame(sample_scores,
index=sample_ids,
columns=pc_ids)
// TODO not yet used/displayed
sample_constraints = pd.DataFrame(np.hstack((Z, F_res)) / scaling_factor,
index=sample_ids,
columns=pc_ids)
// Vegan seems to compute them as corr(X[:, :rank_X],
// u) but I don"t think that"s a good idea. In fact, if
// you take the example shown in Figure 11.3 in L&L 1998 you
// can see that there"s an arrow for each of the 4