mixOmics
mixOmics copied to clipboard
Incorrect behaviour of biplot vectors when setting `keepX`
trafficstars
🐞 Describe the bug:
When running biplot on sparse models, the correlation vectors are showing as right angles. This only happens when keepX is specified.
🔍 reprex results from reproducible example including sessioninfo():
Take the example from the biplot documentation page, but use spca with keepX instead of pca.
This is also reproducible by following the code example in the sPLS documentation page.
library(mixOmics)
data(nutrimouse)
# undergo the pca method
scale.pca.lipid <- pca(nutrimouse$lipid, ncomp = 3, scale = TRUE, center = TRUE)
# do this instead
scale.pca.lipid <- spca(nutrimouse$lipid, keepX = c(5, 5, 5), ncomp = 3, scale = TRUE, center = TRUE)
biplot(scale.pca.lipid) # produce the biplot
The same behaviour doesn't occur when not specifying keepX:
scale.pca.lipid <- spca(nutrimouse$lipid, ncomp = 3, scale = TRUE, center = TRUE)
biplot(scale.pca.lipid) # produce the biplot
🤔 Expected behavior:
The correlation vectors should not be displayed in right angles, but rather to present a behaviour similar as to when keepX is not specified.