Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Zachary Neal <zpneal@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Mata not computing eigenvectors/values |
Date | Mon, 10 Jan 2011 14:28:04 -0500 |
Steven, Yes, using Matthew's commands I am able to get the correct values. But, symeigensystem still doesn't work, even after reinstalling and after trying it on a different machine. I suppose I'll get in touch with support. Thanks for your help, Zachary On Mon, Jan 10, 2011 at 2:14 PM, Steven Samuels <sjsamuels@gmail.com> wrote: > Zachary > > What happens if you run Mathew's Mata commands (below)?. All three Mata > versions and your Stata matrix commands produce the same values for me. In > any case, perhaps there is something wrong with your Mata installation. Try > re-installing Stata and bringing it up to date. If that doesn't work, I > suggest that you contact support. > > Steve > > ********** > eigensystem(A,X=.,L=.) > L' > lefteigensystem(A,Y=.,M=.) > M > *********** > > I would bet there > On Jan 10, 2011, at 1:39 PM, Zachary Neal wrote: > > Sorry, that was a careless typo in my original message. Steven is > right, it should have read: > > symeigensystem(A,eigenvector,eigenvalue) > > However, even with that correction, the outputs - eigenvector and > eigenvalue - are empty. > > In contrast, if I attempt the same thing in stata, using: > matrix A = (0,0,0,0,0,1,0,1,0,0,0,0,0 \ /// > 0,0,0,0,0,0,0,1,0,1,0,0,0 \ /// > 0,0,0,1,0,1,1,0,1,0,1,1,1 \ /// > 0,0,1,0,0,0,1,0,0,0,0,0,0 \ /// > 0,0,0,0,0,0,0,1,0,0,0,0,0 \ /// > 1,0,1,0,0,0,0,0,0,0,0,1,0 \ /// > 0,0,1,1,0,0,0,0,0,0,0,0,0 \ /// > 1,1,0,0,1,0,0,0,0,0,0,0,0 \ /// > 0,0,1,0,0,0,0,0,0,0,0,0,0 \ /// > 0,1,0,0,0,0,0,0,0,0,0,0,0 \ /// > 0,0,1,0,0,0,0,0,0,0,0,0,0 \ /// > 0,0,1,0,0,1,0,0,0,0,0,0,0 \ /// > 0,0,1,0,0,0,0,0,0,0,0,0,0) > matrix symeigen eigenvectors eigenvalues = A > matrix list eigenvectors > matrix list eigenvalues > > I am able to get the correct eigenvectors/values. > > I'm still not sure why this seems to work in stata, but not in mata. > > On Mon, Jan 10, 2011 at 10:15 AM, Steven Samuels <sjsamuels@gmail.com> > wrote: >> >> - >> Zachary's code works for me if I substitute "A" for "network" in the >> -symeigensytem()- command: >> >> symeigensystem(A,eigenvector,eigenvalue) >> >> >> Steve >> Stata 11,1 OS X 10.5.8 >> >> On Jan 9, 2011, at 9:22 PM, Matthew J Baker wrote: >> >> While I am not sure about why the symeigensystem command isn't working, >> the >> problem might have something to do with the "A" matrix being rank >> deficient. >> In any case, I find that the commands: >> >> eigensystem(A,X=.,L=.) >> >> and >> >> lefteigensystem(A,Y=.,M=.) >> >> both generate values for eigenvalues and eigenvectors for the >> aforementioned >> A matrix (collected in X and L, and Y and M, respectively). >> >> Matt Baker >> >> ---- Original message ---- >>> >>> Date: Sun, 9 Jan 2011 17:45:19 -0500 >>> From: owner-statalist@hsphsun2.harvard.edu (on behalf of Zachary Neal >>> <zpneal@gmail.com>) >>> Subject: st: Mata not computing eigenvectors/values >>> To: statalist@hsphsun2.harvard.edu >>> >>> Running the commands below, mata does not yield any eigenvectors or >>> eigenvalues. Computing eigenvectors/values in stata using matrix >>> symeigen seems to work without a problem. Any help would be >>> appreciated. >>> >>> mata >>> A = (0,0,0,0,0,1,0,1,0,0,0,0,0 \ /// >>> 0,0,0,0,0,0,0,1,0,1,0,0,0 \ /// >>> 0,0,0,1,0,1,1,0,1,0,1,1,1 \ /// >>> 0,0,1,0,0,0,1,0,0,0,0,0,0 \ /// >>> 0,0,0,0,0,0,0,1,0,0,0,0,0 \ /// >>> 1,0,1,0,0,0,0,0,0,0,0,1,0 \ /// >>> 0,0,1,1,0,0,0,0,0,0,0,0,0 \ /// >>> 1,1,0,0,1,0,0,0,0,0,0,0,0 \ /// >>> 0,0,1,0,0,0,0,0,0,0,0,0,0 \ /// >>> 0,1,0,0,0,0,0,0,0,0,0,0,0 \ /// >>> 0,0,1,0,0,0,0,0,0,0,0,0,0 \ /// >>> 0,0,1,0,0,1,0,0,0,0,0,0,0 \ /// >>> 0,0,1,0,0,0,0,0,0,0,0,0,0) >>> eigenvector = 0 >>> eigenvalue = 0 >>> symeigensystem(network,eigenvector,eigenvalue) >>> eigenvector >>> eigenvalue >>> end >>> >>> -- >>> Zachary Neal, PhD >>> Department of Sociology >>> Michigan State University >>> zpneal@msu.edu >>> http://www.msu.edu/~zpneal >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/statalist/faq >>> * http://www.ats.ucla.edu/stat/stata/ >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/statalist/faq >> * http://www.ats.ucla.edu/stat/stata/ >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/statalist/faq >> * http://www.ats.ucla.edu/stat/stata/ >> > > > > -- > Zachary Neal, PhD > Department of Sociology > Michigan State University > zpneal@msu.edu > http://www.msu.edu/~zpneal > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > -- Zachary Neal, PhD Department of Sociology Michigan State University zpneal@msu.edu http://www.msu.edu/~zpneal * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/