Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Plotting the impact of a variable with confidence interval


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Plotting the impact of a variable with confidence interval
Date   Mon, 4 Mar 2013 12:13:46 +0100

On Mon, Mar 4, 2013 at 11:23 AM, Md. Alauddin Majumder wrote:
> I have estimated this regression: y = ax + bx^2+......................................... Now, how can I show the impact of x (considering 20<x<40) on y with a confidence interval in a diagram?

See -help margins- and -help marginsplot-. To use that you need to
include your polynomial terms in factor variable notation, i.e.
-c.x##c.x-, see -help fvvarlist-. Below is an example:

*------------------ begin example ------------------
sysuse nlsw88, clear

gen byte marst = !never_married + married  ///
    if !missing(never_married, married)
label variable marst "marital status"
label define marst 0 "never married"       ///
                   1 "divorced or widowed" ///
                   2 "married"
label value marst marst

gen byte black = race == 2 if race < 3
label variable black "race"
label define black 0 "white" ///
                   1 "black"
label value black black

glm wage c.ttl_exp##c.ttl_exp union grade black i.marst, ///
    link(log) vce(robust) eform

margins , at(ttl_exp=(.12 .5 1/28))	
marginsplot, recastci(rarea) ciopts(astyle(ci)) ///
   plotopt(msymbol(i))
*------------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Also see: <http://www.maartenbuis.nl/wp/inter_quadr/inter_quadr.html>

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index