Statalist


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

st: new: ghk2(), enhanced GHK Mata function


From   "David Roodman ([email protected])" <[email protected]>
To   <[email protected]>
Subject   st: new: ghk2(), enhanced GHK Mata function
Date   Tue, 10 Jun 2008 09:12:45 -0400

Kit has just posted ghk2() to SSC, a new Mata implementation of the GHK
algorithm for estimating cumulative multivariate normal probabilities.
It differs from the built-in ghk() and ghkfast() in several ways. It is
modeled on ghkfast(), meaning that it uses pre-generated draws for
speed, and optionally computes scores.

It differs from ghkfast() in that: 1) It works in Stata 9. 2) It accepts
lower as well as upper bounds of integration. Without this feature, if
you need to integrate over a rectilinear d-dimensional region, you'd
have to make 2^d calls to ghk2() (or ghk() or ghkfast()). This is useful
for models with several equations that censor from above and below, such
as with ordered probit and interval regressions. 3) It is an order of
magnitude faster than ghkfast() when the number of observations is high
relative to the number of simulation draws per observation, though it
can be slower at the opposite extreme. 4) It does not "pivot" bounds of
integration, putting the larger entries toward the end. *Not* pivoting
somewhat increases the variability of the simulated probability (see
Rich Gates's article in SJ 6(2)) but eliminates discontinuities in the
function that can otherwise stymie a likelihood search by -ml-,
especially when draws are few. This is a problem I was running into. I
discussed it with Stata, and I'm told that a -nopivot- option is
forthcoming for ghkfast().

The speed benefits may disappear in Stata/MP with a lot of processors. I
haven't tested it, but I believe ghkfast() can benefit from parallelism
while ghk2() cannot, since it is written in Mata.

The help file includes examples and timing tests.

Install with "ssc install ghk2".

-cmp- will soon require ghk2().

--David

David Roodman
Research Fellow
1776 Massachusetts Avenue NW
Washington, DC 20036
Center for Global Development
Independent Research and Practical Ideas for Global Prosperity
 
Phone: 1 202 416-0723
 


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