Displaying 20 results from an estimated 10000 matches similar to: "creating matrices from vectors"
2005 Aug 08
2
computationally singular
Hi,
I have a dataset which has around 138 variables and 30,000 cases. I am
trying to calculate a mahalanobis distance matrix for them and my
procedure is like this:
Suppose my data is stored in mymatrix
> S<-cov(mymatrix) # this is fine
> D<-sapply(1:nrow(mymatrix), function(i) mahalanobis(mymatrix, mymatrix[i,], S))
Error in solve.default(cov, ...) : system is computationally
2011 May 27
1
eigenvalues and correlation matrices
I'm trying to test if a correlation matrix is positive semidefinite.
My understanding is that a matrix is positive semidefinite if it is
Hermitian and all its eigenvalues are positive. The values in my
correlation matrix are real and the layout means that it is symmetric.
This seems to satisfy the Hermitian criterion so I figure that my real
challenge is to check if the eigenvalues are all
2004 Apr 15
5
Solving Matrices
On April 15th, Elizabeth wrote:
<snip>
> In execises 39-42, determine if the columns of the matrix span
> R4:
<snip>
>(or x <- matrix(data=c(7, -5, 6, -7, 2, -3, 10, 9, -5,
> 4, -2, 2, 8, -9, 7, 15), nrow=4, ncol=4)
>
>That is the whole of the question <snip>
Have you tried det(x) and/or eigen(x) ?
A zero determinant (within
2009 Dec 01
1
eigenvalues of complex matrices
Dear all,
I want to compute the eigenvalues of a complex matrix for some statistics.
Comparing it to its matlab/octave sibling, I don't get the same eigenvalues
in R computing it from the exact same matrix.
In R, I used eigen() and arpack() that give different eigenvalues. In
matlab/octave I used eig() and eigs() that give out the same eigenvalues but
different to the R ones.
For real
2006 Apr 04
2
Selecting out certain values from a MATRIX
I have two objects, one matrix and one vector.
I want to use my vector to subset certain values out of my matrix.
For example:
I want to tell R, to select out all rows in myMatrix into a new myMatrix2 IF
that corresponding row is less than a 0.5 in myVector.
So:
myMatrix = a matrix of 8000 by 20
myVector = vector of 8000
myMatrix2 = a matrix of < 8000 by 20 (based on selection criteria in
2012 Mar 09
1
Eigenvalue calculation of sparse matrices
Dear all,
I am currently working on the calculation of eigenvalues (and -vectors)
of large matrices. Since these are mostly sparse matrices and I remember
some specific functionalities in MATLAB for sparse matrices, I started a
research how to optimize the calculation of eigenvalues of a sparse matrix.
The function eigen itself works with the LAPACK library which has no
special handling for
2005 May 01
2
eigen() may fail for some symmetric matrices, affects mvrnorm()
Hi all,
Recently our statistics students noticed that their Gibbs samplers were
crashing due to some NaNs in some parameters. The NaNs came from
mvrnorm (Ripley & Venables' MASS package multivariate normal sampling
function) and with some more investigation it turned out that they were
generated by function eigen, the eigenvalue computing function. The
problem did not seem to happen
2012 Aug 01
1
Error message: $ operator is invalid for atomic vectors
HI,
The code was working perfectly fine yesterday and today, until half an hour ago.? Couldn't find any problems in the code. Still, I am getting error message.
myMatrix <- data.matrix(read.table(text="
Name??????????? Age
ANTONY??????? 27
IMRAN????????? 30
RAJ????????????????? 22
NAHAS????????? 32
GEO??????????????? 42
", header=TRUE))
MinMaxArray? <- data.frame(MIN =
2008 Jun 03
3
matlab eigs function in R
Hello
Does anybody know how one can compute d largest eigenvalues/eigenvectors in
R, like in MATLAB eigs function ? eigen function computes all
eigenvectors/eigenvalues, and they are slightly different than those
generated by matlab eigs.
Thanks in advance
--
View this message in context: http://www.nabble.com/matlab-eigs-function-in-R-tp17619641p17619641.html
Sent from the R help mailing list
2011 Oct 11
2
binding all elements of list (character vectors) to a matrix as rows
dear r-users,
i have got a problem which i am trying to solve:
i have got the following commands:
Mymatrix <- matrix(1:9,ncol=3)
Z <-
list("V1"=c("a","",""),"V2"=c("b","",""),"V3"=c("c","",""),"V4"=c("d","",""))
Mymatrix <-
2008 Jun 18
2
highest eigenvalues of a matrix
DeaR list,
I happily use eigen() to compute the eigenvalues and eigenvectors of
a fairly large matrix (200x200, say), but it seems over-killed as its
rank is limited to typically 2 or 3. I sort of remember being taught
that numerical techniques can find iteratively decreasing eigenvalues
and corresponding orthogonal eigenvectors, which would provide a nice
alternative (once I have the
2010 Jun 25
2
Forcing scalar multiplication.
I am trying to check the results from an Eigen decomposition and I need to force a scalar multiplication. The fundamental equation is: Ax = lx. Where 'l' is the eigen value and x is the eigen vector corresponding to the eigenvalue. 'R' returns the eigenvalues as a vector (e <- eigen(A); e$values). So in order to 'check' the result I would multiply the eigenvalues
2005 Apr 25
1
The eigen function
I'm using R version 2.0.1 on a Windows 2000 operating system. Here is some
actual code I executed:
> test
[,1] [,2]
[1,] 1000 500
[2,] 500 250
> eigen(test, symmetric=T)$values
[1] 1.250000e+03 -3.153033e-15
> eigen(test, symmetric=T)$values[2] >= 0
[1] FALSE
> eigen(test, symmetric=T, only.values=T)$values
[1] 1250 0
> eigen(test, symmetric=T,
2004 Oct 19
3
matrix of eigenvalues
I thought that the function
eigen(A)
will return a matrix with eigenvectors that are independent of each
other (thus forming a base and the matrix being invertible). This
seems not to be the case in the following example
A=matrix(c(1,2,0,1),nrow=2,byrow=T)
eigen(A) ->ev
solve(ev$vectors)
note that I try to get the upper triangular form with eigenvalues on
the diagonal and (possibly) 1 just
2011 Nov 14
2
How to compute eigenvectors and eigenvalues?
Hello.
Consider the following matrix:
mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T)
> mp
[,1] [,2] [,3]
[1,] 0.00 0.25 0.25
[2,] 0.75 0.00 0.25
[3,] 0.25 0.75 0.50
The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is not a diagonalizable matrix.
When you try to find the eigenvalues and eigenvectors with R, R responses:
> eigen(mp)
$values
[1]
2006 Jan 18
1
function 'eigen' (PR#8503)
Full_Name: Pierre Legendre
Version: 2.1.1
OS: Mac OSX 10.4.3
Submission from: (NULL) (132.204.120.81)
I am reporting the mis-behaviour of the function 'eigen' in 'base', for the
following input matrix:
A <- matrix(c(2,3,4,-1,3,1,1,-2,0),3,3)
eigen(A)
I obtain the following results, which are incorrect for eigenvalues and
eigenvectors 2 and 3 (incorrect imaginary portions):
2000 May 10
4
Q: Problems with eigen() vs. svd()
At 01:37 PM 5/10/00 +0200, ralle wrote:
>Hi,
>I have a problem understanding what is going on with eigen() for
>nonsymmetric matrices.
>Example:
>h<-rnorm(6)
>> dim(h)<-c(2,3)
>> c<-rnorm(6)
"c" is not a great choice of identifier!
>> dim(c)<-c(3,2)
>> Pi<-h %*% c
>> eigen(Pi)$values
>[1] 1.56216542 0.07147773
These could
2005 May 02
14
eigenvalues of a circulant matrix
Hi,
It is my understanding that the eigenvectors of a circulant matrix are given as
follows:
1,omega,omega^2,....,omega^{p-1}
where the matrix has dimension given by p x p and omega is one of p complex
roots of unity. (See Bellman for an excellent discussion on this).
The matrix created by the attached row and obtained using the following
commands
indicates no imaginary parts for the
2007 Jun 29
4
Dominant eigenvector displayed as third (Marco Visser)
Dear R users & Experts,
This is just a curiousity, I was wondering why the dominant eigenvetor and eigenvalue
of the following matrix is given as the third. I guess this could complicate automatic selection
procedures.
0 0 0 0 0 5
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
Please
2012 Apr 27
2
find the eigenvector corresponding to the largest eigenvalue
Hi,
If I use the eigen() function to find the eigenvalues of a matrix, how can I find the eigenvector corresponding to the largest eigen value?
Thanks!
[[alternative HTML version deleted]]