Re: Matrix size limitation?

From: Daniel Chessel (chessel@biomserv.univ-lyon1.fr)
Date: Wed Jun 22 2005 - 17:18:55 MEST


Je vérifie les propos de Myriam Gaudeul sur ADE4-classique avec ade4 dans R

w=cbind.data.frame(runif(300),runif(300))
dw=dist(w)
dw=as.matrix(dw)
dw=as.data.frame(dw)

# ça fait une matrice de distances 300-300

library(ade4)
Rtoade4(dw)
File creation dw.txt

Je lis le fichier TextToBin: Text->Binary
puis le résultat par DMAUtil: Read distance file
*------------------------------------------------------------*
| WinADE-4 * Metrowerks CodeWarrior C * CNRS-Lyon1 * JT & DC |
| DMAUtil: Read distance file 22/06/05 16/39 |
*------------------------------------------------------------*
Input file: d:\oper\Essai\dw
*d:\oper\Essai\dw is a binary file with 300 rows and 300 columns :-)
*Squared matrix: Ok
Non negative value: Ok
Dii = 0 for all i: Ok
Symetric matrix: Ok
Test of the euclidean property by diagonalization (theorem of GOWER)
Output file: d:\oper\Essai\dw_R
It has 44850 rows and 1 columns
d(2,1), d(3,1), d(3,2),..., d(n,1), d(n,2), ... d(n,n-1)
Text file: d:\oper\Essai\dw_R.dma
  1 -> 300
  2 -> 1
  3 -> Input distance file d:\oper\Essai\dw
  4 -> TRUE

*Pas de problème, ADE-4 classique diagonalise un matrice 300-300 et
trouve qu'elle est euclidienne :-) *

w=cbind.data.frame(runif(500),runif(500),runif(500),runif(500),runif(500),runif(500))
grosw=dist(w)
grosw=as.matrix(grosw)
grosw=as.data.frame(grosw)

# ça fait une matrice de distances 500-500

Rtoade4(grosw)
*------------------------------------------------------------*
| WinADE-4 * Metrowerks CodeWarrior C * CNRS-Lyon1 * JT & DC |
| DMAUtil: Read distance file 22/06/05 16/52 |
*------------------------------------------------------------*
Input file: d:\oper\Essai\gros
d:\oper\Essai\gros is a binary file with 500 rows and 500 columns
Squared matrix: Ok
Non negative value: Ok
Dii = 0 for all i: Ok
Symetric matrix: Ok
Test of the euclidean property by diagonalization (theorem of GOWER)
Output file: d:\oper\Essai\gros_R
It has 124750 rows and 1 columns
d(2,1), d(3,1), d(3,2),..., d(n,1), d(n,2), ... d(n,n-1)
Text file: d:\oper\Essai\gros_R.dma
  1 -> 500
  2 -> 1
  3 -> Input distance file d:\oper\Essai\gros
  4 -> TRUE
------------------------------------------

*Pas de problème, ADE-4 classique diagonalise un matrice 500-500 et
trouve qu'elle est euclidienne :-)
*Et bien, puisque par DMAUse: Principal Coordinates, on trouve un rang 6
attendu par l'association de 6 variables aléatoires

Rank : 6 Inertia 4.933e-01
Num. Eigenval. R.Iner. R.Sum |Num. Eigenval. R.Iner. R.Sum |
01 +9.6752E-02 +0.1961 +0.1961 |02 +9.0545E-02 +0.1835 +0.3797 |
03 +8.7502E-02 +0.1774 +0.5570 |04 +8.0664E-02 +0.1635 +0.7205 |
05 +7.3166E-02 +0.1483 +0.8688 |06 +6.4702E-02 +0.1312 +1.0000 |

Dans R :
dudi.pco(as.dist(grosw))$eig
[1] 0.09675242 0.09054513 0.08750158 0.08066415 0.07316604 0.06470210

 

*Il ne faut pas confondre avec le message qui accompagne TextToBin qui
dit que le listing est trop long.
Le listing est trop long et n'est pas affiché (il affiche 10 lignes en
début et fin mais avec 500 valeurs par lignes !)*

*Le fichier est bien passé en binaire et les calculs peuvent continuer
tranquillement !*
C'est un problème tout petit d'interface. ADE-4 classique marche encore,
mais, bon, il faut penser à l'avenir !

w=matrix(runif(20000),1000,20)
tresgrosw=dist(w)
dudi.pco(tresgrosw)$eig
Select the number of axes: 50
 [1] 0.10242932 0.10130085 0.09972843 0.09742527 0.09411740 0.09250903
 [7] 0.09014758 0.08777998 0.08569902 0.08457675 0.07974023 0.07817691
[13] 0.07702685 0.07590622 0.07481702 0.07204652 0.07087815 0.06892014
[19] 0.06550515 0.06310714

Les 1000-1000 ne posent pas de problèmes. Bonne nouvelle pour les
généticiens.

Myriam Gaudeul a écrit :

> Hello,
> I am using the 'classical' ADE-4 software (not in R) to compute
> Principal Coordinate Analyses on distance matrices.
> The software does not seem able to handle matrices that are larger
> than 256*256: I get an error message saying that my file is too long
> for ADE4 to read and the output file ends at row 10.
> Did somebody experience a similar problem and managed to solve it? My
> matrices are up to 450*450...
> Thanks in advance,
> Myriam Gaudeul
> -----------------
> Laboratoire d'Ecologie Alpine (LECA)
> Université J. Fourier, Grenoble, France.
>
>



This archive was generated by hypermail 2b30 : Tue Oct 18 2005 - 10:35:40 MEST