Statalist


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

RE: st: Compiling results


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: Compiling results
Date   Fri, 22 Aug 2008 16:17:15 +0200

See http://www.stata-journal.com/article.html?article=pr0036 for the
-postfile- approach...

HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Eva Poen
Sent: Friday, August 22, 2008 4:06 PM
To: [email protected]
Subject: Re: st: Compiling results

Douglas,

I second Martin; -parmest- and -parmby- are excellent for compiling
datasets of estimation results. Note the options -idnum()- and
-idstr()- which you can use to label your different models.

If you want to do it from first principles, you can also use -post-.
Here is your example using the auto data:

********************************
sysuse auto, clear

postfile models rep78 str10 link str5 family b_adj b_unadj using
models.dta, replace
	forvalues i=3/5 {
		qui glm price mpg foreign if rep78==`i', l(log) f(gamma)
/*adjusted model*/
		local adj = _b[mpg]
		qui glm price mpg if rep78==`i', l(log) f(gamma)
/*unadjusted model*/
		local unadj = _b[mpg]
		post models (`i') ("log") ("gamma") (`adj') (`unadj')

		qui glm price mpg foreign if rep78==`i', l(power 0.5)
f(gauss)
/*adjusted model*/
		local adj = _b[mpg]
		qui glm price mpg if rep78==`i', l(power 0.5) f(gauss)
/*unadjusted model*/
		local unadj = _b[mpg]
		post models (`i') ("power 0.5") ("gauss") (`adj') (`unadj')
	}
postclose models

use models, clear
list
**************************************************************

The disadvantage of this approach is that you have to take care of
everything manually that -parmest- does for you: standard errorrs,
degrees of freedom ect.

Hope this helps,
Eva


2008/8/22 Levy, Douglas E., Ph.D. <[email protected]>:
> Hi all,
> I want to streamline the collection of a large number of results.
Specifically,
> I'd like to create a dataset that collects the results from regression
models
> with different functional forms for different subsets of the data, all
while
> keeping track of the types of models used.
>
> For example:
> foreach i of numlist 1/5 {
>   glm Y X W, l(log) f(gamma) if agecat=`i' /*adjusted model*/
>   glm Y X, l(log) f(gamma) if agecat=`i' /*unadjusted model*/
>   glm Y X W, l(power .5) f(gauss) if agecat=`i' /*adjusted model*/
>   glm Y X, l(power .5) f(gauss) if agecat=`i' /*unadjusted model*/
>   }
>
> I would like to keep track of the results in a dataset as follows:
>
> agecat link family _b[X]adjusted _b[X]unadjusted
> 1 log gamma .24334  .63543
> 1 power.5 gauss .43424 .98783
> ..
> 5 log gamma .345543  .6456
> 5 power.5 gauss .54353 .98978
>
> If the results were all numerical, I could compile them in a matrix.
However,
> some of the info in this results dataset is in string format, e.g.
"gauss". Any
> suggestions on an efficient, automatic way to collect all this information
in
> one place? Thanks for any and all advice.
> Best,
> Doug
>
> Douglas Levy, PhD
> Institute for Health Policy
> Massachusetts General Hospital
> 50 Staniford Street; Suite 901
> Boston, MA 02114
> Tel 617.643.3595
> Fax 617.724.4738
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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