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: Twoway quadratic prediction plots with CIs in a multivariate regression setting


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: Twoway quadratic prediction plots with CIs in a multivariate regression setting
Date   Thu, 26 Jul 2012 06:56:57 -0500

The -margins- command has a post option to save the results.  The
example below using Roger Newson's -xsvmat- (ssc desc xsvmat)

webuse nhanes2.dta,clear
qui reg iron c.age##c.age i.race zinc
qui margins , at(age = (10(10)80)  (base) race (zero) zinc)  post
mat a= r(table)
mat A = a'

qui reg iron c.age##c.age i.race zinc
qui margins , at(age = (10(10)80)  ) post
mat b = r(table)
mat B = b'
mat c = r(at)
mat atage = c[1..8,1]

xsvmat A,  name(col) saving(cond.dta,replace)
xsvmat B,  name(col)  saving(uncond.dta,replace)
xsvmat atage,  name(col) saving(age.dta,replace)
use b ll ul using cond,clear
rename * =_cond
merge 1:1 _n  using uncond, nogenerate noreport keepusing(b ll ul)
keep b* ll* ul*
merge 1:1 _n  using  age, nogenerate noreport

line b* age, lc(red blue) ///
 || rcap ul_cond ll_cond age, lc(red) ///
 || rcap ul ll age , lc(blue) ///
 ||, legend(order(1 "Conditional" 2 "Unconditional"))


Scott


On Thu, Jul 26, 2012 at 3:51 AM, Michael Ingenhaag
<[email protected]> wrote:
> Thank you Scott.
>
> I was using something similar, but instead of your proposition
>
> The problem with the marginsplot command is, that I cannot combine other
> graphs as I would like to put graphs of two different models in one plot,
> i.e. for an unconditional and a conditional model. Hence, I was thinking
> about qfitci.
>
> Any further suggestions?
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index