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 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]

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


From   Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Plot estimates and ci from two regressions in one graph
Date   Mon, 18 Jun 2012 06:19:33 -0700

-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



On Mon, Jun 18, 2012 at 5:36 AM, Nikolaos Kanellopoulos
<nkkanel@yahoo.gr> wrote:
> Dear Nick,
>
> thanks for the quick reply.
>
> Unfortunatelly I don't want to plot the predicted probability but the point estimate of x (which in my case is more than one) and it's confidence interval.
> Thank you anyway.
>
> Nikos
>
> ----- Original Message -----
> From: Nick Cox <n.j.cox@durham.ac.uk>
> To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
> Cc:
> Sent: Monday, 18 June 2012, 15:27
> Subject: st: RE: Plot estimates and ci from two regressions in one graph
>
> This doesn't seem to require any user-written stuff.
>
> twoway lfitci <whatever> || lfitci <whatever>
>
> Nick
> n.j.cox@durham.ac.uk
>
> Nikolaos Kanellopoulos
>
> I want to plot the estimates and their confidence intervals from two regressions.
> This sounds like a job for eclplot (downloaded from ssc).  The code in the end of the email shows how this can be done but the graphs for each regression appear next to each other.
> I want to have this in one single graph. I want the estimates from the first regression to appear over those from the second regression.
>
> Is it possible to do something like this in Stata?
>
> Thank you in advance
> Nikos
>
> sysuse auto,clear
>
> tempfile tf1 tf2
> parmby "reg mpg rep78 headroom trunk weight if foreign==0", lab saving(‘tf1’,replace) idn(1) ids(NoFor)
> parmby "reg mpg rep78 headroom trunk weight if foreign==1", lab saving(‘tf2’,replace) idn(2) ids(For)
> dsconcat ‘tf1’ ‘tf2’
> sencode idstr, gene(modtype)
> sencode label, gene(predictor)
> lab var modtype "Type of model"
> lab var predictor "Predictor"
> sort modtype predictor
> eclplot estimate min95 max95 predictor, hori by(modtype,legend(off) compact)
>
>
> *
> *  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/



-- 
Tirthankar Chakravarty
tchakravarty@ucsd.edu
tirthankar.chakravarty@gmail.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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index