Re: [R] order by which the eigenvalues are presented

2015-05-06 Thread Duncan Murdoch
On 06/05/2015 12:58 PM, Luis Borda de Agua wrote: > Thank you, Bill, for your reply. However, I'm afraid I didn't explain myself > properly. > > > > Imagine you have a 2x2 matrix > > Then the eigenvalues lambda_1 and lambda_2 are analytically calculated from > > > > lambda_1 = (-b+sqrt(de

[R] order by which the eigenvalues are presented

2015-05-06 Thread Luis Borda de Agua
Thank you, Bill, for your reply. However, I'm afraid I didn't explain myself properly. Imagine you have a 2x2 matrix Then the eigenvalues lambda_1 and lambda_2 are analytically calculated from lambda_1 = (-b+sqrt(delta))/2a lambda_2 = (-b-sqrt(delta))/2a where delta = b^2-4ac If

Re: [R] order by which the eigenvalues are presented

2015-05-05 Thread William Dunlap
You can sort the eigenvalues in the order you want with o <- order(Re(e$values), decreasing = TRUE) or o <- order(abs(Re(e$values)), decreasing = TRUE) followed by e$values[o] where 'e' is the object that eigen returns. The main argument to order() is what you want to sort by and the s

[R] order by which the eigenvalues are presented

2015-05-05 Thread Luis Borda de Agua
I’m using R 3.1.3 in OS X 10.10.3 (Yosemite) I use the function “eigen” to calculate the eigenvalues of matrix where each element is sampled from a given distribution (normal, beta, etc.). According to the information provided: "values a vector containing the p eigenvalues of x, sorted in decr