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, is already up and running.

[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 <>
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)) ///
*------------------- end example -------------------
(For more on examples I sent to the Statalist see: )

Also see: <>

Hope this helps,

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   For searches and help try:

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