Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Re: Re: Re: RE: Multiple commands under "By varlist"?


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: Re: Re: Re: RE: Multiple commands under "By varlist"?
Date   Sat, 26 Jun 2004 10:56:14 -0400

It looks like you are using Stata7 and I don't think there is a fast version
of statsby prior to version 8.  To get more specific than Nick's loop
description, you could get the speed improvements of the new -statsby- like
this (assuming you aren't using any additional -if- conditions on the model:

gen tintcp=.
gen tslope=.
bysort month: gen int monthN=_N
local last=_N
local i=1
while `i'<`last' {
local j=`i'+monthN[`i']-1
regress returns factor in `i/`j'
replace tintcp = _b[_cons] in `i'/`j'
replace tslope = _b[factor] in `i'/`j'
local i=`j'+1
}


Michael Blasnik
[email protected]

p.s. I haven't tested this code, but it should be close.

----- Original Message ----- 
From: "Subhankar Nayak" <[email protected]>
To: <[email protected]>
Sent: Saturday, June 26, 2004 10:48 AM
Subject: st: Re: Re: Re: RE: Multiple commands under "By varlist"?


> Thanks Michael.
> You are right.
>
> The statsby in our mainframe version of stata seems very old.
> I get the following info:
>
> . which statsby
> /usr/local/stata7/ado/base/s/statsby.ado
> *! version 1.0.8  01jun2001
>
> I will talk to my university system administrator to update these...
>
>
> ----- Original Message ----- 
> From: "Michael Blasnik" <[email protected]>
> To: <[email protected]>
> Sent: Saturday, June 26, 2004 10:22 AM
> Subject: st: Re: Re: RE: Multiple commands under "By varlist"?
>
>
> > I wonder if you are using an up-to-date -statsby- that included some
> > dramatic speed improvements for larger panel datasets like you are
> > sing.  -which statsby- shows the following for me:
> >
> > *! version 2.0.5  13apr2004
> >
> > The key speed improvement is from doing away with the -if- statements in
> the
> > group identification in the code and instead using -in-.  I find that
> > statsby with a regression on 1000 panels takes only slightly longer than
> > by...:regress.  Your finding of 15-20x longer indicates that you are
most
> > likely using the older version.
> >
> > Michael Blasnik
> > [email protected]
>


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