nipals should check that ncomp is not too large

Issue #110 resolved
Former user created an issue

Can you add a line to your mixOmics::nipals function to check that ncomp is not too large?

Something like:

if(ncomp > min(nr,nc) ) stop(" 'ncomp' can be no larger than", min(nr,nc) )

Right now there is no maximum, so crazy things happen...

X <- matrix(rnorm(60), nrow=10) n1=nipals(X, ncomp=1, reconst=TRUE) round(X-n1$rec,2)

n2=nipals(X, ncomp=2, reconst=TRUE) round(X-n2$rec,2)

n3=nipals(X, ncomp=3, reconst=TRUE) round(X-n3$rec,2)

n4=nipals(X, ncomp=4, reconst=TRUE) round(X-n4$rec,2)

n5=nipals(X, ncomp=5, reconst=TRUE) round(X-n5$rec,2)

n6=nipals(X, ncomp=6, reconst=TRUE) round(X-n6$rec,2)

this should not be allowed

n20=nipals(X, ncomp=20, reconst=TRUE) round(X-n20$rec,2) n20$eig

Comments (1)

  1. Log in to comment