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

From |
Asgar Khademvatani <akhademv@ucalgary.ca> |

To |
statalist@hsphsun2.harvard.edu |

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" <akhademv@ucalgary.ca>

To: <statalist@hsphsun2.harvard.edu>

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/

**References**:**st: Calculating Determinant of Hessian Matrix Over Obervations***From:*Asgar Khademvatani <akhademv@ucalgary.ca>

**st: Re: Calculating Determinant of Hessian Matrix Over Obervations***From:*"Michael Blasnik" <michael.blasnik@verizon.net>

- Prev by Date:
**Re: st: Oaxaca and heckmanan** - Next by Date:
**st: Optional arguments in Mata** - Previous by thread:
**st: Re: Calculating Determinant of Hessian Matrix Over Obervations** - Next by thread:
**st: Duration models: database preparation** - Index(es):

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