Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: A Loop for Making Matrixes and calculating Eigenvalues for each Observation


From   Asgar Khademvatani <akhademv@ucalgary.ca>
To   statalist@hsphsun2.harvard.edu
Subject   st: A Loop for Making Matrixes and calculating Eigenvalues for each Observation
Date   Mon, 17 Sep 2007 01:46:14 -0600

Dear Statalist,

I have already generated four variable A, B, C, and D each contains 43 observation inn Stata V8.2. I want to make 43 square matrix (2 by 2) using each of 43 observation based on each observation of these variables. Then, I want to calclate the real Eigenvalues of each matrix and list each of them. I need to wrire a loop to do this job. Actually, I have already written the following loop using "foreach command" but I am getting the following error as follows;

foreach i = 1/43 {
2. matrix K[`i'] = (A[`i'], B[`i'] \ C[`i'],D[`i'])
3. matrix symeigen X[`i'] V[`i'] = K[`i']
4. matrix list V[`i']
5. }
invalid syntax
r(198);

end of do-file
r(198);

May anybody in the list please help me out on this matter or say me how can I perform this job more efficiently?

Thanks in advance

Asgar Khademvatani
University of Calgary-Canada
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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