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

Re: st: calculating outer products

From   "Austin Nichols" <>
Subject   Re: st: calculating outer products
Date   Wed, 5 Mar 2008 11:34:18 -0500

Stephen Younger <>:
I sincerely doubt you need to calculate such large products, but see

help mat accum
help mf_cross

Maybe if you describe the actual calculation, using a -sysuse- dataset like so:

sysuse auto, clear
reg mpg wei, nohe
mat li e(V)
mat accum xx=wei
predict e, res
g e2=e^2
su e2
loc s=r(mean)
mat V=74/(72)*`s'*invsym(xx)
mat li V

someone can suggest a more efficient solution (probably using Mata).

Are you by any chance recreating the -cluster- option?

On Wed, Mar 5, 2008 at 10:13 AM, Stephen D Younger <> wrote:
> Hello,
> I need to calculate outer products of data vectors to estimate the
> standard errors of income or tax shares. Ideally, these would be
> (NxK)*(KxN), though (Nx1)*(1xN) would do. N is pretty large, 1000-5000
> records, usually. Is there a way to do this in Stata?
> --
> Stephen D. Younger
> 607 274 3134
*   For searches and help try:

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