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   Tue, 5 Mar 2013 15:49:13 +0100

Where any of the explanatory/independent/right-hand-side/x-variables
dropped due to collinearity? I tried this out witht the examples from
-xtreg- help-file and noticed that that caused problems, but when I
excluded those variables from the model everything worked out fine:

*------------------ begin example ------------------
webuse nlswork
xtset idcode
// grade and race are dropped due to collinearity
// -margins- returns only (not estimable)
xtreg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp ///
      tenure c.tenure#c.tenure 2.race not_smsa south, fe
margins, at(age=(17/44))

// now everything works
xtreg ln_w age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp ///
      tenure c.tenure#c.tenure not_smsa south, fe
margins, at(age=(17/44))
*------------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

On Tue, Mar 5, 2013 at 2:56 PM, Md. Alauddin Majumder
<[email protected]> wrote:
> Hi Maarten,
> I've just tried the following:
>
> quietly xtreg y c.x##c.x $human_capital $demographic $employment_characteristics $industry $yeardummy $attitude $others if dmale==1 & dwhite==1, fe vce(cl id)
> margins, at(x==(15(1)20))
>
> It gives the following output:
>
> Predictive margins                                Number of obs   =       5554
> Model VCE    : Robust
>
> Expression   : Linear prediction, predict()
>
> 1._at        : x=          15
>
> 2._at        : x=          16
>
> 3._at        : x=          17
>
> 4._at        : x=          18
>
> 5._at        : x=          19
>
> 6._at        : x=          20
>
> ------------------------------------------------------------------------------
>              |            Delta-method
>              |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>          _at |
>           1  |          .  (not estimable)
>           2  |          .  (not estimable)
>           3  |          .  (not estimable)
>           4  |          .  (not estimable)
>           5  |          .  (not estimable)
>           6  |          .  (not estimable)
> ------------------------------------------------------------------------------
>
> Accordingly, the command "marginsplot" gives me a blank diagram. Can you pls provide any suggestions in this regard? Thanks!
>
> Regards
> Md. Majumder
>
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Maarten Buis [[email protected]]
> Sent: Monday, March 04, 2013 5:13 AM
> To: [email protected]
> Subject: Re: st: Plotting the impact of a variable with confidence interval
>
> 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/
>
>
>
> *
> *   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/



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