Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behaviour of biplot vectors when setting keepX #311

Open
vinisalazar opened this issue Jul 16, 2024 · 1 comment
Open

Incorrect behaviour of biplot vectors when setting keepX #311

vinisalazar opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vinisalazar
Copy link


🐞 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 vinisalazar added the bug Something isn't working label Jul 16, 2024
@vinisalazar
Copy link
Author

I noticed that the problem starts as keepX starts distancing from the original number of features:

scale.pca.lipid <- spca(nutrimouse$lipid, ncomp = 3, scale = TRUE, center = TRUE, keepX=rep(ncol(nutrimouse$lipid) - 10, 3)) 
biplot(scale.pca.lipid)

Screenshot 2024-07-16 at 13 41 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants