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

From |
"Mitrani, Alex" <Alex.Mitrani@sdgworld.net> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Re: programming stata: storing results in arrays for future reference |

Date |
Tue, 22 Jun 2004 18:28:00 +0100 |

Rafa, Kit Thanks to you both for your helpful suggestions, I will take note of these for future reference. A quick fix I found was to run the models "quietly" and only report the results of interest, such as e(ll), after each run. If I were to refine the program I would use one of the approaches you suggest, however, as it was actually very useful to see the estimation results as well as the summary table. Thanks again. Alex -----Original Message----- From: R.E. De Hoyos [mailto:redeho@hotmail.com] Sent: 21 June 2004 14:52 To: statalist@hsphsun2.harvard.edu Subject: st: Re: programming stata: storing results in arrays for future reference Alex, There are several ways to save the log likelihood values. You can include a local macro that retrieves the log likelihood estimate using the -ereturn- post estimation results. Let's say you want to retrieve the log likelihood estimated from a set of mlogit using a loop: foreach x in 0.1 0.2 0.5 { mlogit depvar indvar (scaling factor==`x') local ll_`x'=`e(ll)' } Where `e(ll)' is a scalar containing the log likelihood estimated result. You will have all the log likelihood results in local macros named ll_(scaling factor). Alternatively you can generate new variables containing the log likelihood, you simple change local ll_`x' for gen ll_`x' in the above loop. You can also use the command -est store- to store all the estimation outcome, this will allow you to access all the estimated results and post estimation commands (and est. scalars, macros and matrix). Type -ereturn list- after an estimation to see all the values that you can retrieve and save after each estimation. I hope this helps, Rafa ----- Original Message ----- From: "Mitrani, Alex" <Alex.Mitrani@sdgworld.net> To: <statalist@hsphsun2.harvard.edu> Sent: Friday, June 18, 2004 6:56 PM Subject: st: programming stata: storing results in arrays for future reference > Dear stata users, > > I am embarking on my first programming exercise with stata, and would appreciate a little advice. The task involves getting a model command to iterate a number of times with a sub-set of the independent variables being systematically modified each time using different values of a scaling factor (say going from 0 to 5 in increments of 0.1). I need to retrieve the log likelihood of each model, and display them alongside the corresponding values of the scaling factor. In this way the scalilng factor that results in the model best fitting the data can be obtained. > > I am sure this is all possible, but having read the material in the users' guide on programming stata, I cannot see a simple way of storing the different values of the log likelihood in an array (I know that this is very straight-forward in most other programming languages), so that they can be conveniently displayed after the model runs have been finished, for instance by looping a display command over all the values contained in the array. > > Any help with this would be greatly appreciated. > > > Alex > > > > > > Alex Mitrani > > > Steer Davies Gleave > 28-32 Upper Ground, London SE1 9PD, UK > > [direct] +44 (0)20 7910 5578 > [main] +44 (0)20 7919 8500 > [fax] +44 (0)20 7827 9850 > [e-mail] alex.mitrani@sdgworld.net > > http://www.steerdaviesgleave.com/ > This message is sent in confidence for the addressee only. It may contain legally privileged information. The contents are not to be disclosed to anyone other than the addressee. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. > > > * > * 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/ > * * 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/ * * 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: A question about ordered probit and ordered logit** - Next by Date:
**Re: st: egen and computing fixed effects** - Previous by thread:
**st: A question about ordered probit and ordered logit** - Next by thread:
**st: egen and computing fixed effects** - Index(es):

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