[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
jjc.li@utoronto.ca |

To |
statalist@hsphsun2.harvard.edu |

Subject |
RE: st: RE: use Mata to calculate the eigenvalues of the matrix |

Date |
Sun, 08 Mar 2009 16:23:13 -0400 |

Thank you all! It works! The new codes are: mata: M = st_matrix("M") M = M[,7..16]' lambda = J(cols(M), 4, .) for(t=1; t<=cols(M); t++) { mt = invvech(M[., t]) lambda[t, .] = symeigenvalues(mt) } lambda end

Jingjing Quoting Glenn Goldsmith <glenn.goldsmith@gmail.com>:

Hi, In addition to what Nick said: 1. I think that you want to be looping through the *rows* of your M matrix, rather than the columns as you are trying to do now. 2. It doesn't look like you actually want all the rows of your M matrix as it stands, you only want the last 10. An *easy* way to achieve this (though not the most *elegant* way of proceeding) would be to insert M = M[,7..16]' after the first line of your code. M = st_matrix("M") M = M[,7..16]' lambda = J(cols(M), 4, .) for(t=1; t<=cols(M); t++) { mt = invvech(M[., t]) lambda[t, .] = symeigenvalues(mt) } HTH Glenn. * * 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/

**References**:**RE: st: RE: use Mata to calculate the eigenvalues of the matrix***From:*"Glenn Goldsmith" <glenn.goldsmith@gmail.com>

- Prev by Date:
**AW: st: new user written program stochastic inequality** - Next by Date:
**Re: st: new user written program stochastic inequality** - Previous by thread:
**RE: st: RE: use Mata to calculate the eigenvalues of the matrix** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |