Skip to contents

This functions allow to test for the number of axes in multivariate analysis. The procedure testdim.pca implements a method for principal component analysis on correlation matrix. The procedure is based on the computation of the RV coefficient.

Usage

testdim(object, ...)
# S3 method for pca
testdim(object, nrepet = 99, nbax = object$rank, alpha = 0.05, ...)

Arguments

object

an object corresponding to an analysis (e.g. duality diagram, an object of class dudi)

nrepet

the number of repetitions for the permutation procedure

nbax

the number of axes to be tested, by default all axes

alpha

the significance level

...

other arguments

Value

An object of the class krandtest. It contains also:

nb

The estimated number of axes to keep

nb.cor

The number of axes to keep estimated using a sequential Bonferroni procedure

References

Dray, S. (2008) On the number of principal components: A test of dimensionality based on measurements of similarity between matrices. Computational Statistics and Data Analysis, Volume 52, 2228--2237. doi:10.1016/j.csda.2007.07.015

Author

Stéphane Dray stephane.dray@univ-lyon1.fr

Examples

tab <- data.frame(matrix(rnorm(200),20,10))
pca1 <- dudi.pca(tab,scannf=FALSE)
test1 <- testdim(pca1)
test1
#> class: krandtest lightkrandtest 
#> Monte-Carlo tests
#> Call: testdim.pca(object = pca1)
#> 
#> Number of tests:   10 
#> 
#> Adjustment method for multiple comparisons:   none 
#> Permutation number:   99 
#>       Test       Obs    Std.Obs   Alter Pvalue
#> 1   Axis 1 0.5923081 -0.1620144 greater   0.54
#> 2   Axis 2 0.5285317 -1.8071384 greater   0.99
#> 3   Axis 3 0.5903391 -0.9589534 greater   0.84
#> 4   Axis 4 0.5851335 -1.0277549 greater   0.85
#> 5   Axis 5 0.6572883  0.1123162 greater   0.45
#> 6   Axis 6 0.6547971  0.3919727 greater   0.26
#> 7   Axis 7 0.7134174  1.1958308 greater   0.14
#> 8   Axis 8 0.8443807  4.1360788 greater   0.01
#> 9   Axis 9 0.8967238  4.2287495 greater   0.01
#> 10 Axis 10 1.0000000  6.5991361 greater   0.01
#> 
test1$nb
#> [1] 0
test1$nb.cor
#> [1] 0
data(doubs)
pca2 <- dudi.pca(doubs$env,scannf=FALSE)
test2 <- testdim(pca2)
test2
#> class: krandtest lightkrandtest 
#> Monte-Carlo tests
#> Call: testdim.pca(object = pca2)
#> 
#> Number of tests:   11 
#> 
#> Adjustment method for multiple comparisons:   none 
#> Permutation number:   99 
#>       Test       Obs    Std.Obs   Alter Pvalue
#> 1   Axis 1 0.9276029  9.8230582 greater   0.01
#> 2   Axis 2 0.8765561  6.1643389 greater   0.01
#> 3   Axis 3 0.8195407 -1.1692191 greater   0.89
#> 4   Axis 4 0.7130800  0.8246494 greater   0.21
#> 5   Axis 5 0.7621707  2.0138184 greater   0.04
#> 6   Axis 6 0.7781209  2.4575465 greater   0.04
#> 7   Axis 7 0.8316557  4.8180087 greater   0.01
#> 8   Axis 8 0.9641126  5.1280553 greater   0.01
#> 9   Axis 9 0.7978495  1.3216083 greater   0.13
#> 10 Axis 10 0.9701563  6.8085521 greater   0.01
#> 11 Axis 11 1.0000000  8.7154388 greater   0.01
#> 
test2$nb
#> [1] 2
test2$nb.cor
#> [1] 2