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 17:02:41 -0500

```On Tue, Dec 28, 2010 at 1:20 PM, David Torres <torresd@umich.edu> wrote:
> My particular problem is that I do not know how to graph a plot with the
> confidence bands and region of significance.  I just need something simple
> like that seen on page 214 of the article I mention by Preacher et al.
> (2007).  The function for plotting is laid out on page 202, equation 20.
>
> Preacher, K., Rucker, D., & Hayes, A.  (2007).  Addressing moderated
> mediation hypotheses: Theory, methods, and prescriptions.  Multivariate
> Behavioral Research 42(1), 185-227.
>
> I'm not familiar with any examples on the web, but then again perhaps
> moderated mediation is not in wide use.

No doubt it is very popular.
Drawing graphs with confidence intervals in Stata is explained in the
Stata graphics gallery here:
http://www.ats.ucla.edu/stat/stata/library/GraphExamples/default.htm

Specifically here:
http://www.ats.ucla.edu/stat/stata/library/GraphExamples/code/tworarea.htm
with the code and an example of the output that it produces.

You write "I don't plan on wasting too many hours trying to figure out
what I need to do"
What you need to do is to
1) use the formula you quote to generate the data points (I presume by
varying W, for given values
of the other coefficients), then
2) use the code that I refer to actually plot it.

Best, S.R.

>
> Diego
>
>
> --
> David Diego Torres, MA(Sociology)
> PhD Candidate in Sociology
>
> 2044 Population Studies Center
> University of Michigan Institute for Social Research
> Ann Arbor MI  48106-1248
> Tel 734.763.4098
> Fax 734.763.1428
> torresd at umich dot edu
>
>
>
>> 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/
>>
>>
>>
>
>
> *
> *   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/
```