Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Plot estimates and ci from two regressions in one graph |

Date |
Thu, 21 Jun 2012 09:18:03 +0100 |

I see here { { } } which looks fine to me. But the code won't run unless various user-written programs have been installed previously. Nick On Thu, Jun 21, 2012 at 9:13 AM, Muhammad Anees <anees@aneconomist.com> wrote: > Thanks for the nice effort, > > but the code will work smoothly and only if "}" a used a once. On Thu, Jun 21, 2012 at 1:06 PM, Nikolaos Kanellopoulos >> Tirthankar thank you very much for the suggestion to use marginsplot (it never crossed my mind). >> >> Since I had something more specific in my mind I tried to utilize the flexibility of Stata and its tw command and I think I found a solution to my problem. >> If anybody has anything to add in order to improve the following code is more than welcome. >> >> Nikos >> >> >> *----------------------------------------------------------------------------------------------------------------- >> >> sysuse auto, clear >> levelsof for, local(a) >> tempfile file >> >> foreach i of local a { >> sysuse auto, clear >> count if for==`i' >> >> if r(N)>=1 { >> regress mpg c.(rep78 headroom trunk weight) if for==`i' >> parmest, norestore >> egen axis= axis(estimate), label(parm) >> gen for=`i' >> capture append using `file' >> save `file', replace >> local kk=`i1'+1 >> } >> } >> >> gsort axis -for >> gen order=_N-_n >> >> label define jj 1 "_cons" 3 "rep78" 5 "headroom" /// >> 7 "weight" 9 "trunk" >> label value order jj >> >> twoway /// >> (scatter order est if for==1, msymbol(circle)) /// >> (scatter order est if for==0, msymbol(T)) /// >> (rcap min95 max95 order, horizontal ), /// >> ylabel(1(2)9, valuelabel angle(0)) ytitle("") /// >> legend(order (1 2) label(1 "for==1") label(2 "for==0")) /// >> xtitle("Coefficients and confidence interval") >> *----------------------------------------------------------------------------------------------------------------- From: Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> >> -marginsplot- is very powerful for these kinds of problems. >> >> *------------------------------------------------------------------------ >> sysuse auto, clear >> reg mpg i.foreign##c.(rep78 headroom trunk weight) >> margins, dydx(*) over(foreign) >> marginsplot, xdim(_deriv) >> *------------------------------------------------------------------------ >> >> Note however that without standardizing the variables, you might not >> be able to make out the variations in coefficients across groups. >> >> T >> * * 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/

**References**:**st: Plot estimates and ci from two regressions in one graph***From:*Nikolaos Kanellopoulos <nkkanel@yahoo.gr>

**st: RE: Plot estimates and ci from two regressions in one graph***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: Plot estimates and ci from two regressions in one graph***From:*Nikolaos Kanellopoulos <nkkanel@yahoo.gr>

**Re: st: RE: Plot estimates and ci from two regressions in one graph***From:*Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>

**Re: st: RE: Plot estimates and ci from two regressions in one graph***From:*Nikolaos Kanellopoulos <nkkanel@yahoo.gr>

**Re: st: RE: Plot estimates and ci from two regressions in one graph***From:*Muhammad Anees <anees@aneconomist.com>

- Prev by Date:
**Re: st: RE: Plot estimates and ci from two regressions in one graph** - Next by Date:
**Re: st: Convergence never achieved with MI impute chained** - Previous by thread:
**Re: st: RE: Plot estimates and ci from two regressions in one graph** - Next by thread:
**st: Exposition of F-statistics of the Regression Significance and the Log-Likelihood via -outreg2-** - Index(es):