It appears that the initial values for the constant-only model are
hard-coded.
Using the lognormal distribution as an example, you can alter (after making
a copy for safekeeping) -lnormal.ado- so that if accepts the initial values
passed to it.
If you alter line 142:
*/ init(_cons=1) /*
to
*/ `iniopt' /*
it will take the values passed to it from -from()-
Now, there is only one iteration in the constant-only model in the second
specification below:
sysuse cancer, clear
qui stset studytime, failure(died)
qui streg , dist(lnorm)
matrix b0 = e(b)
streg study age , dist(lnorm) from(b0) trace
. qui stset studytime, failure(died)
. qui streg , dist(lnorm)
. matrix b0 = e(b)
. streg study age , dist(lnorm) from(b0) trace
failure _d: died
analysis time _t: studytime
Fitting constant-only model:
Iteration 0:
Coefficient vector:
_t: ln_sig:
_cons _cons
r1 2.768933 .1422957
log likelihood = -60.991749
Iteration 1:
Coefficient vector:
_t: ln_sig:
_cons _cons
r1 2.768933 .1422957
log likelihood = -60.991749
Fitting full model:
.
.
.
Hope this helps,
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Maarten buis
> Sent: Monday, January 02, 2006 2:33 PM
> To: [email protected]
> Subject: RE: st: Efficiency of calculating maximum likelihood
>
> Hi Steinar,
>
> My initial guess was you could use the previous estimates as starting
> values. It might speed
> things up, but as the example below shows, that does not have to be. In
> the example the model with
> starting values needed more itterations than the model without.
>
> *------------begin example--------------
> sysuse cancer, clear
> stset studytime, failure(died)
> xi: streg i.drug age, dist(lnorm)
> matrix b0 = e(b)
> xi: streg i.drug , dist(lnorm) from(b0, skip)
> xi: streg i.drug , dist(lnorm)
> *-------------end example-----------------
>
> HTH,
> Maarten
>
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting adress:
> Buitenveldertselaan 3 (Metropolitan), room Z214
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
> Steinar Fossedal wrote:
> > I'm trying to fit a model using stepwise selection, and so I
> > reestimate fairly similar models over and over. Fitting a model
> > using -streg- takes about an hour using my dataset. I noticed
> > that two thirds of the calculation time is spent calculating
> > the constant-only model - which is exactly the same for all the
> > estimations. Is there any way of making stata use the results
> > of previous calculations to save time in this process?
>
*
* 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/