Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-07 Thread Coline Boonman
Dear Emmanual,

 

Thank you again for your email. The answer to isSymmetric(matrix_dissim_Eucl) 
is indeed TRUE. Thus the pcoa input is symmetric and has no complex values, but 
still the error ‘Error in min(D.eig$values) : invalid ‘type’ (complex) of 
argument’  occurs.

 

I hope that you or someone else can figure out why this error occurs.

 

Kind regards,

Coline

 

 

From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Tuesday, 7 April 2020 05:15
To: Coline Boonman 
Cc: r-sig-phylo 
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R

 

Hi Coline,

 

Matrix symmetry is not about row- and colnames but about testing, for a square 
matrix X, if X[i, j] == X[j, i] for all i and j = 1, ..., n. I've just had a 
look at the code of isSymmetrix.matrix() and this is done by testing equality 
of X and t(X), so effectively making a copy of X which seems to explain why you 
run out of memory for this test (apart from the fact that you may have 
memory-hungry applications running on your computer...)

 

You may try this instead:

 

matrix_dissim_Eucl <- as.matrix(mat_dissim_Eucl)

rm(mat_dissim_Eucl)

gc()

isSymmetric(matrix_dissim_Eucl)

 

If you still run out of memory, try to quit some applications (Web browsers of 
Office typically use a lot of memory).

 

Anyway, it doesn't change the fact that daisy(), like dist(), returns only the 
lower triangle of the distance matrix, so as.matrix() should return a symmetric 
matrix with its diagonal set to 0. So the above check is just to be sure.

 

Best,

 

Emmanuel

 

- Le 6 Avr 20, à 22:00, Coline Boonman < <mailto:c.boon...@science.ru.nl> 
c.boon...@science.ru.nl> a écrit :



Dear Emmanual,

 

Thank you for your response! I have checked your code, and I get the following:

 

matrix_dissim_Eucl<-as.matrix(mat_dissim_Eucl)

 

any(is.complex(matrix_dissim_Eucl))

#FALSE

 isSymmetric.matrix(matrix_dissim_Eucl)

# Error: cannot allocate vector of size 811.1Mb

So I checked by hand (I think it checks for row and column length, and for 
equal row and column names

dim(matrix_dissim_Eucl)

#14582 14582

summary(colnames(matrix_dissim_Eucl)==row.names(matrix_dissim_Eucl))

#TRUE 14582

 

So I guess this means that it is a symmetric matrix that enters the pcoa 
function, and that there are no complex values in the matrix.

 

I hope there is one thing I did not think of yet, and you can help me figure it 
out. In any case, thank you for your help. I really appreciated it.

 

Kind regards,

Coline

From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Monday, 6 April 2020 16:47
To: Coline Boonman mailto:c.boon...@science.ru.nl> >
Cc: r-sig-phylo mailto:r-sig-phylo@r-project.org> >
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R

 

Hi Coline,

 

Actually the test would be:

 

any(is.complex(mat_dissim_Eucl))

 

And you may also test:

 

isSymmetric(as.matrix(mat_dissim_Eucl))

 

But it'd very surprising this 2nd test returns FALSE.

 

So if your matrix is real and symmetric, I don't see why you have complex 
eigenvalues from its decomposition.

 

Best,

 

Emmanuel

- Le 6 Avr 20, à 21:16, Coline Boonman < <mailto:c.boon...@science.ru.nl> 
c.boon...@science.ru.nl> a écrit :

Dear Emmanual,

 

Thank you for your email. I have been trying to understand what is going on and 
if your suggestion is correct. However, if I test for complex numbers in my 
dissimilarity matrix (converted to a matrix: 
is.complex(as.matrix(mat_dissim_Eucl)) ) R gives me the result FALSE. That 
means that there are no complex numbers in the input for the pcoa, right? 

 

I hope you or someone else has another suggestion on why I get this error.

 

Kind regards,

Coline

 

From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Thursday, 2 April 2020 07:43
To: Coline Boonman mailto:c.boon...@science.ru.nl> >
Cc: r-sig-phylo mailto:r-sig-phylo@r-project.org> >
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R

 

Hi Coline,

 

This is strange: you calculate a distance matrix with daisy(), so the 
as.matrix() operation should return a symmetric matrix. Symmetric (real) 
matrices have all their eigenvalues real numbers. Maybe some complex values 
were produced by daisy()?

 

Best,

 

Emmanuel

 

- Le 30 Mar 20, à 22:58, Coline Boonman < <mailto:c.boon...@science.ru.nl> 
c.boon...@science.ru.nl> a écrit :



Dear reader,

 

I am working with the pcoa function of ape in R and I got the error message: 
“min(D.eig$values) : invalid 'type' (complex) of argument” .

My input data is a distance matrix, which pcoa first converts to a matrix in 
the first line within the code of the function. The error occurs when it wants 
to check for negative eigenvalues at the line ‘ min.eig <- min(D.eig$values)’

I checked D.eig$values and indeed they are

Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-06 Thread Emmanuel Paradis
Hi Coline, 

Matrix symmetry is not about row- and colnames but about testing, for a square 
matrix X, if X[i, j] == X[j, i] for all i and j = 1, ..., n. I've just had a 
look at the code of isSymmetrix.matrix() and this is done by testing equality 
of X and t(X), so effectively making a copy of X which seems to explain why you 
run out of memory for this test (apart from the fact that you may have 
memory-hungry applications running on your computer...) 

You may try this instead: 

matrix_dissim_Eucl <- as.matrix(mat_dissim_Eucl) 
rm(mat_dissim_Eucl) 
gc() 
isSymmetric(matrix_dissim_Eucl) 

If you still run out of memory, try to quit some applications (Web browsers of 
Office typically use a lot of memory). 

Anyway, it doesn't change the fact that daisy(), like dist(), returns only the 
lower triangle of the distance matrix, so as.matrix() should return a symmetric 
matrix with its diagonal set to 0. So the above check is just to be sure. 

Best, 

Emmanuel 

- Le 6 Avr 20, à 22:00, Coline Boonman  a écrit : 

> Dear Emmanual,

> Thank you for your response! I have checked your code, and I get the 
> following:

> matrix_dissim_Eucl<-as.matrix(mat_dissim_Eucl)

> any(is.complex(matrix_dissim_Eucl))

> #FALSE

> isSymmetric.matrix(matrix_dissim_Eucl)

> # Error: cannot allocate vector of size 811.1Mb

> So I checked by hand (I think it checks for row and column length, and for 
> equal
> row and column names

> dim(matrix_dissim_Eucl)

> #14582 14582

> summary(colnames(matrix_dissim_Eucl)==row.names(matrix_dissim_Eucl))

> #TRUE 14582

> So I guess this means that it is a symmetric matrix that enters the pcoa
> function, and that there are no complex values in the matrix.

> I hope there is one thing I did not think of yet, and you can help me figure 
> it
> out. In any case, thank you for your help. I really appreciated it.

> Kind regards,

> Coline

> From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr]
> Sent: Monday, 6 April 2020 16:47
> To: Coline Boonman 
> Cc: r-sig-phylo 
> Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
> ape
> in R

> Hi Coline,

> Actually the test would be:

> any(is.complex(mat_dissim_Eucl))

> And you may also test:

> isSymmetric(as.matrix(mat_dissim_Eucl))

> But it'd very surprising this 2nd test returns FALSE.

> So if your matrix is real and symmetric, I don't see why you have complex
> eigenvalues from its decomposition.

> Best,

> Emmanuel

> - Le 6 Avr 20, à 21:16, Coline Boonman < [ mailto:c.boon...@science.ru.nl 
> |
> c.boon...@science.ru.nl ] > a écrit :

>> Dear Emmanual,

>> Thank you for your email. I have been trying to understand what is going on 
>> and
>> if your suggestion is correct. However, if I test for complex numbers in my
>> dissimilarity matrix (converted to a matrix:
>> is.complex(as.matrix(mat_dissim_Eucl)) ) R gives me the result FALSE. That
>> means that there are no complex numbers in the input for the pcoa, right?

>> I hope you or someone else has another suggestion on why I get this error.

>> Kind regards,

>> Coline

>> From: Emmanuel Paradis [ [ mailto:emmanuel.para...@ird.fr |
>> mailto:emmanuel.para...@ird.fr ] ]
>> Sent: Thursday, 2 April 2020 07:43
>> To: Coline Boonman < [ mailto:c.boon...@science.ru.nl | 
>> c.boon...@science.ru.nl
>> ] >
>> Cc: r-sig-phylo < [ mailto:r-sig-phylo@r-project.org | 
>> r-sig-phylo@r-project.org
>> ] >
>> Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
>> ape
>> in R

>> Hi Coline,

>> This is strange: you calculate a distance matrix with daisy(), so the
>> as.matrix() operation should return a symmetric matrix. Symmetric (real)
>> matrices have all their eigenvalues real numbers. Maybe some complex values
>> were produced by daisy()?

>> Best,

>> Emmanuel

>> - Le 30 Mar 20, à 22:58, Coline Boonman < [ 
>> mailto:c.boon...@science.ru.nl |
>> c.boon...@science.ru.nl ] > a écrit :

>>> Dear reader,

>>> I am working with the pcoa function of ape in R and I got the error message:
>>> “min(D.eig$values) : invalid 'type' (complex) of argument” .

>>> My input data is a distance matrix, which pcoa first converts to a matrix 
>>> in the
>>> first line within the code of the function. The error occurs when it wants 
>>> to
>>> check for negative eigenvalues at the line ‘ min.eig <- min(D.eig$values)’

>>> I checked D.eig$values and indeed they are complex numbers (imaginary 
>>> numbers).
>>> What I don’t understand is why these are created. I never had any issues 
>>

Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-06 Thread Coline Boonman
Dear Emmanual,

 

Thank you for your response! I have checked your code, and I get the following:

 

matrix_dissim_Eucl<-as.matrix(mat_dissim_Eucl)

 

any(is.complex(matrix_dissim_Eucl))

#FALSE

 isSymmetric.matrix(matrix_dissim_Eucl)

# Error: cannot allocate vector of size 811.1Mb

So I checked by hand (I think it checks for row and column length, and for 
equal row and column names

dim(matrix_dissim_Eucl)

#14582 14582

summary(colnames(matrix_dissim_Eucl)==row.names(matrix_dissim_Eucl))

#TRUE 14582

 

So I guess this means that it is a symmetric matrix that enters the pcoa 
function, and that there are no complex values in the matrix.

 

I hope there is one thing I did not think of yet, and you can help me figure it 
out. In any case, thank you for your help. I really appreciated it.

 

Kind regards,

Coline

From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Monday, 6 April 2020 16:47
To: Coline Boonman 
Cc: r-sig-phylo 
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R

 

Hi Coline,

 

Actually the test would be:

 

any(is.complex(mat_dissim_Eucl))

 

And you may also test:

 

isSymmetric(as.matrix(mat_dissim_Eucl))

 

But it'd very surprising this 2nd test returns FALSE.

 

So if your matrix is real and symmetric, I don't see why you have complex 
eigenvalues from its decomposition.

 

Best,

 

Emmanuel

- Le 6 Avr 20, à 21:16, Coline Boonman mailto:c.boon...@science.ru.nl> > a écrit :



Dear Emmanual,

 

Thank you for your email. I have been trying to understand what is going on and 
if your suggestion is correct. However, if I test for complex numbers in my 
dissimilarity matrix (converted to a matrix: 
is.complex(as.matrix(mat_dissim_Eucl)) ) R gives me the result FALSE. That 
means that there are no complex numbers in the input for the pcoa, right? 

 

I hope you or someone else has another suggestion on why I get this error.

 

Kind regards,

Coline

 

From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Thursday, 2 April 2020 07:43
To: Coline Boonman mailto:c.boon...@science.ru.nl> >
Cc: r-sig-phylo mailto:r-sig-phylo@r-project.org> >
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R

 

Hi Coline,

 

This is strange: you calculate a distance matrix with daisy(), so the 
as.matrix() operation should return a symmetric matrix. Symmetric (real) 
matrices have all their eigenvalues real numbers. Maybe some complex values 
were produced by daisy()?

 

Best,

 

Emmanuel

 

- Le 30 Mar 20, à 22:58, Coline Boonman mailto:c.boon...@science.ru.nl> > a écrit :




Dear reader,

 

I am working with the pcoa function of ape in R and I got the error message: 
“min(D.eig$values) : invalid 'type' (complex) of argument” .

My input data is a distance matrix, which pcoa first converts to a matrix in 
the first line within the code of the function. The error occurs when it wants 
to check for negative eigenvalues at the line ‘ min.eig <- min(D.eig$values)’

I checked D.eig$values and indeed they are complex numbers (imaginary numbers). 
What I don’t understand is why these are created. I never had any issues with 
the pcoa function before, and now I change my dataset and this happens. The 
distance matrix values range from 0 to 47 and I have species names as rownames 
and column names. In the attachment I include a small piece of the dataset and 
the code I run. I checked when the error occurs, and I don’t see why the extra 
line (2063) gives the error.

 

I hope someone can help me.

 

Kind regards,

Coline Boonman

-- 

PhD student

Department of Environmental Science

Faculty of Science

Radboud University Nijmegen 

 

P.O. Box 9010, NL-6500 GL Nijmegen

E: c.boon...@science.ru.nl <mailto:c.boon...@science.ru.nl> 

T: + 31 (0)243653270 / + 31 (0)243653281 (secr.)

 

http://www.ru.nl/environmentalscience

 

 

 

 


___
R-sig-phylo mailing list - R-sig-phylo@r-project.org 
<mailto:R-sig-phylo@r-project.org> 
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/




[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-06 Thread Emmanuel Paradis
Hi Coline, 

Actually the test would be: 

any(is.complex(mat_dissim_Eucl)) 

And you may also test: 

isSymmetric(as.matrix(mat_dissim_Eucl)) 

But it'd very surprising this 2nd test returns FALSE. 

So if your matrix is real and symmetric, I don't see why you have complex 
eigenvalues from its decomposition. 

Best, 

Emmanuel 

- Le 6 Avr 20, à 21:16, Coline Boonman  a écrit : 





Dear Emmanual, 



Thank you for your email. I have been trying to understand what is going on and 
if your suggestion is correct. However, if I test for complex numbers in my 
dissimilarity matrix (converted to a matrix: 
is.complex(as.matrix(mat_dissim_Eucl)) ) R gives me the result FALSE. That 
means that there are no complex numbers in the input for the pcoa, right? 



I hope you or someone else has another suggestion on why I get this error. 



Kind regards, 

Coline 




From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Thursday, 2 April 2020 07:43 
To: Coline Boonman  
Cc: r-sig-phylo  
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R 





Hi Coline, 





This is strange: you calculate a distance matrix with daisy(), so the 
as.matrix() operation should return a symmetric matrix. Symmetric (real) 
matrices have all their eigenvalues real numbers. Maybe some complex values 
were produced by daisy()? 





Best, 





Emmanuel 





- Le 30 Mar 20, à 22:58, Coline Boonman < [ mailto:c.boon...@science.ru.nl 
| c.boon...@science.ru.nl ] > a écrit : 


BQ_BEGIN


Dear reader, 



I am working with the pcoa function of ape in R and I got the error message: 
“min(D.eig$values) : invalid 'type' (complex) of argument” . 

My input data is a distance matrix, which pcoa first converts to a matrix in 
the first line within the code of the function. The error occurs when it wants 
to check for negative eigenvalues at the line ‘ min.eig <- min(D.eig$values)’ 

I checked D.eig$values and indeed they are complex numbers (imaginary numbers). 
What I don’t understand is why these are created. I never had any issues with 
the pcoa function before, and now I change my dataset and this happens. The 
distance matrix values range from 0 to 47 and I have species names as rownames 
and column names. In the attachment I include a small piece of the dataset and 
the code I run. I checked when the error occurs, and I don’t see why the extra 
line (2063) gives the error. 



I hope someone can help me. 



Kind regards, 

Coline Boonman 

-- 

PhD student 

Department of Environmental Science 

Faculty of Science 

Radboud University Nijmegen 



P.O. Box 9010, NL-6500 GL Nijmegen 

E: [ mailto:c.boon...@science.ru.nl | c.boon...@science.ru.nl ] 

T: + 31 (0)243653270 / + 31 (0)243653281 (secr.) 



[ http://www.ru.nl/environmentalscience | http://www.ru.nl/environmentalscience 
] 










___ 
R-sig-phylo mailing list - [ mailto:R-sig-phylo@r-project.org | 
R-sig-phylo@r-project.org ] 
[ https://stat.ethz.ch/mailman/listinfo/r-sig-phylo | 
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo ] 
Searchable archive at [ http://www.mail-archive.com/r-sig-phylo@r-project.org/ 
| http://www.mail-archive.com/r-sig-phylo@r-project.org/ ] 




BQ_END



[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-06 Thread Coline Boonman
Dear Emmanual,

 

Thank you for your email. I have been trying to understand what is going on and 
if your suggestion is correct. However, if I test for complex numbers in my 
dissimilarity matrix (converted to a matrix: 
is.complex(as.matrix(mat_dissim_Eucl)) ) R gives me the result FALSE. That 
means that there are no complex numbers in the input for the pcoa, right? 

 

I hope you or someone else has another suggestion on why I get this error.

 

Kind regards,

Coline

 

From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] 
Sent: Thursday, 2 April 2020 07:43
To: Coline Boonman 
Cc: r-sig-phylo 
Subject: Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of 
ape in R

 

Hi Coline,

 

This is strange: you calculate a distance matrix with daisy(), so the 
as.matrix() operation should return a symmetric matrix. Symmetric (real) 
matrices have all their eigenvalues real numbers. Maybe some complex values 
were produced by daisy()?

 

Best,

 

Emmanuel

 

- Le 30 Mar 20, à 22:58, Coline Boonman mailto:c.boon...@science.ru.nl> > a écrit :



Dear reader,

 

I am working with the pcoa function of ape in R and I got the error message: 
“min(D.eig$values) : invalid 'type' (complex) of argument” .

My input data is a distance matrix, which pcoa first converts to a matrix in 
the first line within the code of the function. The error occurs when it wants 
to check for negative eigenvalues at the line ‘ min.eig <- min(D.eig$values)’

I checked D.eig$values and indeed they are complex numbers (imaginary numbers). 
What I don’t understand is why these are created. I never had any issues with 
the pcoa function before, and now I change my dataset and this happens. The 
distance matrix values range from 0 to 47 and I have species names as rownames 
and column names. In the attachment I include a small piece of the dataset and 
the code I run. I checked when the error occurs, and I don’t see why the extra 
line (2063) gives the error.

 

I hope someone can help me.

 

Kind regards,

Coline Boonman

-- 

PhD student

Department of Environmental Science

Faculty of Science

Radboud University Nijmegen 

 

P.O. Box 9010, NL-6500 GL Nijmegen

E: c.boon...@science.ru.nl <mailto:c.boon...@science.ru.nl> 

T: + 31 (0)243653270 / + 31 (0)243653281 (secr.)

 

http://www.ru.nl/environmentalscience

 

 

 

 


___
R-sig-phylo mailing list - R-sig-phylo@r-project.org 
<mailto:R-sig-phylo@r-project.org> 
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-01 Thread Emmanuel Paradis
Hi Coline, 

This is strange: you calculate a distance matrix with daisy(), so the 
as.matrix() operation should return a symmetric matrix. Symmetric (real) 
matrices have all their eigenvalues real numbers. Maybe some complex values 
were produced by daisy()? 

Best, 

Emmanuel 

- Le 30 Mar 20, à 22:58, Coline Boonman  a écrit : 

> Dear reader,

> I am working with the pcoa function of ape in R and I got the error message:
> “min(D.eig$values) : invalid 'type' (complex) of argument” .

> My input data is a distance matrix, which pcoa first converts to a matrix in 
> the
> first line within the code of the function. The error occurs when it wants to
> check for negative eigenvalues at the line ‘ min.eig <- min(D.eig$values)’

> I checked D.eig$values and indeed they are complex numbers (imaginary 
> numbers).
> What I don’t understand is why these are created. I never had any issues with
> the pcoa function before, and now I change my dataset and this happens. The
> distance matrix values range from 0 to 47 and I have species names as rownames
> and column names. In the attachment I include a small piece of the dataset and
> the code I run. I checked when the error occurs, and I don’t see why the extra
> line (2063) gives the error.

> I hope someone can help me.

> Kind regards,

> Coline Boonman

> --

> PhD student

> Department of Environmental Science

> Faculty of Science

> Radboud University Nijmegen

> P.O. Box 9010, NL-6500 GL Nijmegen

> E: c.boon...@science.ru.nl

> T: + 31 (0)243653270 / + 31 (0)243653281 (secr.)

> http://www.ru.nl/environmentalscience

> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/