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

Wrong axes limits in PCA distance plot when data contains excluded outliers #94

Closed
svkucheryavski opened this issue Jan 20, 2021 · 0 comments
Labels
Milestone

Comments

@svkucheryavski
Copy link
Owner

svkucheryavski commented Jan 20, 2021

When dataset contains hidden (excluded) outliers, plotResiduals() does not take this into account and computes much larger limits. This code reproduces the problem graphically (see the second plot):

library(mdatools)
set.seed(42)

# generate data and add an outlier
X <- matrix(rnorm(100 * 10), 100, 10)
X[20, ] <- X[20, ] * 10

# make two models, one with outlier and one where outlier is excluded
m1 <- pca(X, 5)
m2 <- pca(X, 5, exclrows = 20)

# show the plots
par(mfrow = c(1, 3))
plotResiduals(m1)
plotResiduals(m2)
plotResiduals(m2, show.excluded = TRUE)

The problem is in ldecomp.plotResiduals() function, which code has to be refactored.

@svkucheryavski svkucheryavski added this to the 0.11.3 milestone Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant