mixOmics icon indicating copy to clipboard operation
mixOmics copied to clipboard

Incorrect behaviour of biplot vectors when setting `keepX`

Open vinisalazar opened this issue 1 year ago • 1 comments
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

Screenshot 2024-07-16 at 13 20 14

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

Screenshot 2024-07-16 at 13 23 38


🤔 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.

vinisalazar avatar Jul 16 '24 03:07 vinisalazar