Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: using estimates coefficients


From   Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: using estimates coefficients
Date   Wed, 21 Mar 2012 14:04:17 -0400

You can loop over the different models

-------------------------------------
sysuse auto, clear
* Estimate models and store each
reg price mpg
est store model1
reg weight mpg
est store model2
reg turn mpg
est store model3
* Create global=0 for the sum
glo sum=0
* Add the coefficients
forv i=1(1)3 {
        * Restore model
	est restore model`i'
        * Add coefficient to sum
	glo sum=${sum}+_b[mpg]
}
* Display sum
di "${sum}"

_______________________
Jorge Eduardo Pérez Pérez




On Wed, Mar 21, 2012 at 1:22 PM, Muhammad Anees <anees@aneconomist.com>
wrote:
>
> Althoug I am not sure, I have tried this and it has worked;
>
> regress dv1=in1 in2 in3 in4
> display _b[in1]
> gen agea=-.00036117
> regress dv1=in1 in2 in3 in4
> display _b[in1]
> gen ageb=-.00036117
> gen sumab=agea+ageb
> display sumab
>
> and so on to include other coefficients from other models.
>
> I Hope this may be of help
>
> Anees
>
> On Wed, Mar 21, 2012 at 9:24 PM, Chiara Mussida <cmussida@gmail.com>
> wrote:
> > Dear All,
> > I run (7) different equations, simple reg command. I now have to play
> > with the coefficient estimates of each equation, _b[name]
> >
> > Each of the 7 estimates have been carried out and stored with diffrent
> > names (model1,..., model7). I now must sum the coefficients of each
> > regressors of the different models, like the sum of _b[age] for all
> > the 7 models.
> >
> > How should I compute (manually) this sum across all the models?
> > _b[age] model1 + _b[age] model2 + ... + _b[age] model7
> >
> > I will have also to include the mean values of each characteristics,
> > but for this it is enough to gen an ad hoc variable for each case.
> >
> > Thanks
> > CHiara
> >
> >
> > --
> > Chiara Mussida
> > PhD candidate
> > Doctoral school of Economic Policy
> > Catholic University, Piacenza (Italy)
> > *
> > *   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/
>
>
>
> --
>
> Best
> ---------------------------
> Muhammad Anees
> Assistant Professor/Programme Coordinator
> COMSATS Institute of Information Technology
> Attock 43600, Pakistan
> http://www.aneconomist.com
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index