Statalist


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

Re: st: Re: Calculating Determinant of Hessian Matrix Over Obervations


From   Asgar Khademvatani <[email protected]>
To   [email protected]
Subject   Re: st: Re: Calculating Determinant of Hessian Matrix Over Obervations
Date   Mon, 01 Oct 2007 12:48:40 -0600

Hello ,

As Michael said, it might be easy directly to calculate the determinant of a matrix 2 by 2 by -gen- command, but calculating the determinants of matrices with higher degrees such as 3 by 3 and higher might be difficult by -gen- command , so the question still remains how can I do it through a loop using-det- command?

Asgar

Michael Blasnik wrote:


listed, then why not just calculate it directly using -gen-?

gen det=A*C-B^2

Michael Blasnik


----- Original Message ----- From: "Asgar Khademvatani" <[email protected]>
To: <[email protected]>
Sent: Monday, October 01, 2007 7:34 AM
Subject: st: Calculating Determinant of Hessian Matrix Over Obervations



Dear All,

I have 43 observation on t he variables  A, B, and C. I am trying to
make 43 symmetry Hessian matrix(2 by 2) and calculate each matrix
determinant and list the calculated determinants for each observation. I
have made the following loop but it is subject to error as follows;

forvalues i = 1/43 {
   matrix H = (A[`i'], B[`i'] \ B[`i'], C[`i'])
  gen det_H =  det(H)
   di "`i'"
    matrix list Ha_g_1
   list det_H
   }
I am getting the following error as follows;

   +----------+
    | det_H |
    |----------|
 1. | 6.28e-13 |
<snip>

*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index