| testdim {ade4} | R Documentation |
This functions allow to test for the number of axes in multivariate analysis. The procedure is only implemented for principal component analysis on correlation matrix. The procedure is based on the computation of the RV coefficient.
testdim(dudi, ...) ## S3 method for class 'pca': testdim(dudi, nrepet = 99, nbax = dudi$rank, alpha = 0.05, ...)
dudi |
a 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 |
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 |
Stephane Dray dray@biomserv.univ-lyon1.fr
Dray, S. (2007) On the number of principal components: A test of dimensionality based on measurements of similarity between matrices. Computational Statistics and Data Analysis, in press.
tab <- data.frame(matrix(rnorm(200),20,10)) pca1 <- dudi.pca(tab,scannf=FALSE) test1 <- testdim(pca1) test1 test1$nb test1$nb.cor data(doubs) pca2 <- dudi.pca(doubs$mil,scannf=FALSE) test2 <- testdim(pca2) test2 test2$nb test2$nb.cor
> library(ade4)
> ### Name: testdim
> ### Title: Function to perform a test of dimensionality
> ### Aliases: testdim testdim.pca
> ### Keywords: multivariate
>
> ### ** Examples
>
> tab <- data.frame(matrix(rnorm(200),20,10))
> pca1 <- dudi.pca(tab,scannf=FALSE)
> test1 <- testdim(pca1)
> test1
class: krandtest
Monte-Carlo tests
Call: testdim.pca(dudi = pca1)
Test number: 10
Permutation number: 99
Test Obs Std.Obs Alter Pvalue
1 Axis 1 0.5754389 -0.7788928 greater 0.81
2 Axis 2 0.6644669 0.9606160 greater 0.20
3 Axis 3 0.6557210 0.1901559 greater 0.42
4 Axis 4 0.6970035 -0.1572369 greater 0.48
5 Axis 5 0.7389212 1.0312897 greater 0.15
6 Axis 6 0.7195032 1.6013217 greater 0.08
7 Axis 7 0.7520397 2.3792042 greater 0.02
8 Axis 8 0.8616320 3.6664826 greater 0.01
9 Axis 9 0.7311890 0.3059093 greater 0.35
10 Axis 10 1.0000000 4.7288302 greater 0.01
other elements: nb nb.cor
> test1$nb
[1] 0
> test1$nb.cor
[1] 0
> data(doubs)
> pca2 <- dudi.pca(doubs$mil,scannf=FALSE)
> test2 <- testdim(pca2)
> test2
class: krandtest
Monte-Carlo tests
Call: testdim.pca(dudi = pca2)
Test number: 11
Permutation number: 99
Test Obs Std.Obs Alter Pvalue
1 Axis 1 0.9276029 8.1908092 greater 0.01
2 Axis 2 0.8765561 5.1610629 greater 0.01
3 Axis 3 0.8195407 -1.1308706 greater 0.90
4 Axis 4 0.7130800 0.8359168 greater 0.23
5 Axis 5 0.7621707 1.7325389 greater 0.05
6 Axis 6 0.7781209 2.3032324 greater 0.03
7 Axis 7 0.8316557 4.7990456 greater 0.01
8 Axis 8 0.9641126 4.4190248 greater 0.01
9 Axis 9 0.7978495 1.3429964 greater 0.13
10 Axis 10 0.9701563 7.7595169 greater 0.01
11 Axis 11 1.0000000 7.8768202 greater 0.01
other elements: nb nb.cor
> test2$nb
[1] 2
> test2$nb.cor
[1] 2
>
>
>
>