加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

交互效应作图全攻略(线性+非线性)

(2014-04-05 03:14:36)
标签:

调节效应

作图

交互项

回归

logit调节效应

分类: 04STATA数据处理
首先是参考几个帖子:
好,以上就是各位博主post的有关调节效应的原理以及作图相关的问题。
到了做个总结的时候了。我们的叙述将在两个方向展开:1.线性方程; 2.非线性方程。

在外文期刊中,出现了交互效应 图形的论文较多,例如:


A.首先我们来看简单的线性方程中 交互项后 怎么生成图形?
   EQUATION:Y = b0 + b1X + b2Z + b3XZ
   这里还可以分成几种情况来讨论这个graph问题:
   (1)X 、Z 都是连续型变量
   (2)X 、Z 都是分类型变量
   (3)X 、Z 一个是连续型变量、一个是分类型变量
     可以参考的资料:
       http://bbs.pinggu.org/thread-2913777-1-1.html  上面的解决方案参考了 第3个网页 的内容。
       在作图中有两个重要的命令:
       margins 、 marginsplot

    



B.看看复杂的非线性方程中 调节效应 的作图问题?



Bibliography

1.Aiken L S, West S G. Multiple regression: Testing and interpreting interactions[M]. Sage, 1991.

2.Cohen J, Cohen P, West S G, et al. Applied multiple regression/correlation analysis for the behavioral sciences[M]. Routledge, 2003.

3.Dawson J F, Richter A W. Probing three-way interactions in moderated multiple regression: development and application of a slope difference test[J]. Journal of Applied Psychology, 2006, 91(4): 917.

4.Friedrich, R. J. 1982. In defense of multiplicative terms in multiple regression equations. American Journal of Political Science, 26(4): 797-833

5.http://www.quantpsy.org/interact/

6.http://www.ats.ucla.edu/stat/stata/dae/ztp.htm



附件:

A.以前我在人大经济论坛的发帖:
OLS回归中交互效应作图:
参考一个资料:http://www.quantpsy.org/interact/mlr2.htm
我的模拟数据,首先是 OLS 回归: 
(数据下载:在STATA中命令行输入:use http://www.ats.ucla.edu/stat/data/hsbdemo, clear)

1.regress read c.math##c.socst
(这里  自变量 因变量 都是连续型数值型变量。)

2.我要的结果,做出类似下面这样的一张图:
       目前找到相关资料:http://www.ats.ucla.edu/stat/stata/faq/margins_graph12.htm                                       http://www.ats.ucla.edu/stat/stata/faq/conconb12.htm   
       看了这个资料后,还是不会做,因为这个例子讲的是 一个连续性变量 和 分类变量的情况,如果两个变量都是连续型的呢,怎么作图,特别是做出置信区间的 虚线。

Stata FAQ
How can I graph the results of the margins command? (Stata 12)

Graphing results from the margins command can help in the interpretation of your model. Stata 12 introduced the marginsplotcommand which make the graphing process very easy.

Let's start off with an easy example.



Stata FAQ
How can I explain a continuous by continuous interaction? (Stata 12)

An earlier versions of this web page showed how to explain continuous by continuous interactions using methods available inStata 10 and earlier and in Stata 11. These methods continue to work in Stata 12. However, Stata 12 has some new features that make graphing ofcontinuous by continuous interactions a bit easier.

 

First off, let's start with what a significant continuous by continuous interaction means. It means that the slope of one continuous variable on the response variable changes as the values on a second continuous change.

 

Multiple regression models often contain interaction terms. This FAQ page covers the situation in which there is a moderator variable which influences the regression of the dependent variable on an independent/predictor variable. In other words, a regression model that has a significant two-way interaction of continuous variables.

 

There are several approaches that one might use to explain an interaction of two continuous variables. The approach that we will demonstrate is to compute simple slopes, i.e., the slopes of the dependent variable on the independent variable when the moderator variable is held constant at different combinations of values from very low to very high.

 

We will consider a regression model which includes a continuous by continuous interaction of a predictor variable with a moderator variable. In the formula, Y is the response variable, X the predictor (independent) variable with Z being the moderator variable. The term XZ is the interaction of the predictor with the moderator.

Y = b0 + b1X + b2Z + b3XZ

We will illustrate the simple slopes process using the hsbdemo dataset that has a statistically significant continuous by continuous interaction. As shown in the code below that read is the response variable, math is the predictor and socst is the moderator variable.





怎么才能生成 我给的这张图,特别是做出置信区间的 虚线



 

参考的图例

 

use http://www.ats.ucla.edu/stat/data/hsbdemo, clear

regress read c.math##c.socst                          //OLS regression
sum math                                              //Check the lower and uper bound of math
margins, at(math=(28(2)76)) vsquish                   //Calculate margins from lower to upper bound of math with a step 2
set scheme s1mono                                     //Set the color scheme to journal style(B-W)
marginsplot                                           //Plot the above mentioned margins
                                                      //Change ci-plot to dash line and retitle Y and X
marginsplot, recast(line) recastci(rline) ///
    ytitle("Read Score") xtitle("Math Score") ///
        ciopts(lpattern(dash)) 

B.他人发帖:
huangspace 把问题发在我的留言,我替他贴到这里来了。
罗老师,您好!我最近在写一篇涉及交互作用的文章,之前看了您的一篇关于《关于「交互作用」Interaction Effect》的文章,其中很想看您的交互图是怎么画的,可惜那个图片的链接坏了了,如果方便,可否请您更新一下,或者发到我的有效呢?非常感谢!) K, G5 X, b; o) A2 p. C* `
$ t2 _. Z! M1 t- k
××××××××××××××××××××××××××××××××××××××××××××××××/ V/ M% [  i. r# N# d% Y" D

Huangspace,

以下是步骤:3 F  w: u2 u1 [+ v7 l+ _9 Y
1. 假设X -> Y , 调节变量(交互作用相同)是Z
2. 找出Z的平均数(Mean),标准差(SD)和中位数(Med)
3. 在数据中用做指标 (index)把数据排序,从Z最小到Z最大;2 \0 j# d- e0 p) _- D

方法一:
1. 把数据用来分,用Med所有数据分成两组,3 Y* @# r# E# Z# @
  一组是Z;
  一组是Z>Med# I7 T- u; Z- U3 n7 @, O, I
2. 在每一组做一个XY的回归分析,找出截距斜率,画出两条直线。6 W3 i+ o) y9 t; m5 p- Q( x' a
, Y4 \8 K6 N, X) O  G! x" C7 E9 |
方法二:  h2 x: k) t4 M8 V, k" m% }% |
1. 把数据用来分,用Mean所有数据分成两组,
  一组是Z;4 E5 U/ n/ A. i  z2 ^9 I
  一组是Z>Mean+SD
  中间的数据不要;
2. 在每一组做一个XY的回归分析,找出截距斜率,画出两条直线。

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有