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

# Re: st: plotting conditional indirect effect with confidence bands

 From Sergiy Radyakin To statalist@hsphsun2.harvard.edu Subject Re: st: plotting conditional indirect effect with confidence bands Date Tue, 28 Dec 2010 10:58:35 -0500

```On Tue, Dec 28, 2010 at 10:11 AM, David Torres <torresd@umich.edu> wrote:
> Hello,
>
> I'm hoping someone can help me with stata code for producing a graph that
> plots the conditional indirect effect with confidence bands.  I just
> completed a moderated mediation analysis using Preacher et al.'s (2007) SPSS
> macro, and have attempted to use SigmaPlot to do the graph portion as
> Preacher did.  No success.  The program is new to me and I don't plan on
> wasting too many hours trying to figure out what I need to do.
>
> Preacher, K., Rucker, D., & Hayes, A.  (2007).  Addressing moderated
> mediation hypotheses: Theory, methods, and prescriptions.  _Multivariate
> Behavioral Research_ _42_(1), 185-227.
>
> I have the component values needed:  the point estimate as well as the
> second order variance (as page 202 of Preacher et al. highlights).  I just
> need some advice from someone a bit more versed in Stata than I am.
>
> Anyone?  Anyone?

What exactly the problem is ? Graphing? Math? Programming?
If you have all the components, plug them in to the twoway statement
below code instead of ms, msl, msh.
Best, S.R.

version 11
clear

sysuse sp500.dta
lowess high date, gen(ms) bw(0.1) nodraw
gen msl = ms*0.95
gen msh = ms*1.05
twoway  line msh msl date , lp("-" "-") lc(gray gray) || line high
date, scale(0.5) lw(0.7) lc(brown)
xline(`=date("29mar2001","DMY")',lw(1) lc(green)) yline(1100,lw(1)
lc(green)) legend(off)

>
> Diego Torres
> *
> *   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/
```