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

From |
Kit Baum <baum@bc.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: R and Stata efficiency |

Date |
Wed, 11 Jul 2007 08:46:36 -0400 |

But as R is a matrix language, the relevant comparison is with Mata, not with Stata. Stata's matrix language is cumbersome (relative to Mata) and much less flexible, as noted, than Mata. You can do exactly the sort of thing you describe below (including element-by-element computations) in Mata.

Also see Ben Jann's excellent -moremata- suite of additional Mata functions (ssc desc moremata).

Kit Baum, Boston College Economics and DIW Berlin

http://ideas.repec.org/e/pba1.html

An Introduction to Modern Econometrics Using Stata:

http://www.stata-press.com/books/imeus.html

On Jul 11, 2007, at 2:33 AM, David wrote:

One other issue is that the result of a command (sic in Stata) cannot be used directly as the argument of another commmand. In R, I can do something like dhdbeta = A %*% diag(exp(aacoef)) in which, exp() gives the exponential values of the elements in aacoef, then diag() makes a matrix with the diagonal being those exponential values, then the matrix is multiplied on the left by another matrix A. The exp() and diag() are calculated on the fly and discarded afterwards. Their values are not used elsewhere and thus there is no need to save them explicitly just for the next step. While in Stata, I have save them.

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

- Prev by Date:
**st: Re: R and Stata efficiency** - Next by Date:
**Re: st: Copy table--how to consistently get correct tab stops** - Previous by thread:
**st: Re: R and Stata efficiency** - Index(es):

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