R数据分析:跨层中介的原理和做法,实例操练

之前有同学问过我211模型,没听过这个词,感觉怎么有这么不严肃的名字,偷偷去查了查,211模型,其实就是嵌套数据的中介的情形之一。根本上讲还是属于多水平模型的路径分析(用多水平模型跑回归也可以做中介,但其不在本文讨论范围,本文主要关注多水平结构方程multilevel structural equation modeling MSEM框架下的中介做法)。然后偷偷整理了下这方面的内容,今天刚刚好给大家写一些这方面的内容,希望对大家有所帮助。

经典的中介模型是不考虑嵌套的,数据一旦嵌套起来,这个时候就有必要考虑多水平中介分析了(其根本依然在于taking into account bias in standard errors resulting from a lack of independence among observations in such data):

The classic mediation model (that assumes independent observations, that is, no clustering) has been extensively studied . Extending the classic mediation model to clustered data is referred to as multilevel mediation analysis.

当我的数据是嵌套数据时,做中介分析的时候我们的变量就有可能在不同的水平测量的。

比如学生嵌套在学校的这么一个研究中(学生是一个水平,学校是高水平),我可以研究学校的文化通过影响学生学习兴趣从而影响学生成绩(自变量在高水平,中介和因变量低水平,叫做211模型):

2-1-1 (level-2 independent, level-1 mediator, level-1 dependent) multilevel mediation model

我还可以研究学校资金投入通过影响学校文化进而影响学生成绩(自变量和中介变量都高水平,因变量是低水平,叫做221模型):

The DV will always be a level one variable. Depending on your data, the IV and MV may be either level 1 or level 2 variables

反正就是记住:多水平中介,无论是111,还是211,还是221,还是112模型,这里面的数字都是指的是变量的测量水平,这种变量分布在不同水平(层)的中介作用就叫做跨层中介。

The DV and MV must be a continuous variables. The IV may be a continuous or binary predictor variable. While the CVs may be continuous, binary or factor variables.

多水平中介的理论基础

写这一部分之前先回顾经典中介模型:

以及路径图所对应的统计模型

Coefficient c denotes the total effect of X on Y, coefficient a quantifies the effect of X on M, coefficient c′ is the direct effect of X on Y (the effect of X onY that is not transmitted through M), and coefficient b describes the effect of M on Y holding X constant. Note that Equations 1 to 3 represent the classic formulation of a single-mediator model shown in Figure 1 (Baron & Kenny, 1986; MacKinnon, 2008). The terms ε1, ε2, and ε3 denote the residuals and d1, d2, and d3 represent intercepts.

上面的内容很简单,不解释。

现在大家可以想一想如果你拿到一个嵌套数据,你想做个211模型,你怎么办?把数据都合并到学校的水平?或者将学校水平的变量都扩展到学生的水平?很浅显的道理,第一种方法会导致数据变少,而第二种方法会导致学校水平的变量重复变多,这两种处理都不合适

Because of the limitations of single-level analytic techniques (e.g., multiple regression), researchers had to either choose individuals or groups as the unit of analysis. Data were then disaggregated to the individual level, or aggregated to the group level, in order to maintain a single-level analysis

还有问题,如果你将高水平的变量扩展,也会出现概念上的问题。举个例子,比如你的数据库中现在有一个level2的变量叫做“班级学习氛围”,我想研究班级学习氛围影响个人学习动机从而个人影响学习成绩(211模型),如果我以学生为单位进行分析就相当于我将班级学习氛围这个变量扩展到每一个学生上,就是每个学生(每一条分析的数据)都有一个变量叫做班级氛围,暗含的意思是班级氛围从属于学生,这明显在概念或者理论上也解释不通的:

This produces conceptual problems (e.g., individuals possessing organizational qualities such as size) and statistical problems (e.g., standard errors for size being calculated on the number of individuals in the study as opposed to the number of colleges)

这个时候,对于多水平数据做中介的时候,我们需要的是能够能够将数据的多个水平同时考虑而不合并或者分解数据avoid the aggregation or disaggregation。

我们的正确的做法就是将变量的变异分解,分解为within-groups组内效应和between-groups组间效应。

什么是within-groups组内效应,什么又是组间效应呢?

再想想我们的数据水平,比如学生嵌套在学校,组内就是具体某个学校中的每个学生和这个学校所有学生均值的差或者叫变异,这个叫做组内效应(在这里,“组”是学校的意思);还有一层是每个学校和学校之间有不同,具体某个学校和全体学校均值的差,叫做组间效应。这样做一分解,组内效应+组间就是因子方差。

For each individual, the within-groups component is represented by the individual's deviation from the group's mean, while the between-groups component consists of the disaggregated group mean。 The advantage of this technique is that the two components are orthogonal and additive, and therefore, the approach acknowledges two sources of error variance.

同样的道理可以延申到重复测量数据,比如是一个个体随访多次的纵向研究,个体内就是组内,个体间就是组间。

对于重复测量的嵌套数据的理解也是一样的,大家参看下面的图,此时每个人就是一个所谓的“组”,相应的组内效应和组间效应也就成了Within Person 和Between Person:

如此分解之后就可以有两个部分的协方差矩阵,就可以结构方程模型来估计多水平数据的路径分析结果了:

The decomposition of individuals' scores into their within- and between-groups components can be used to compute a between-groups covariance matrix (~B) and a within-groups covariance matrix (~w)' These covariance matrices can be described as separate models for the between- groups and the within-groups structures (Muthen, 1994):

下面就是使用多水平结构方程探讨211模型的变异分解示意图:

我们有xmy三个变量,x为高水平的变量,相应的也就只有高水平的变异,m和y都是低水平变量,其变异可以分解为组内变异和组间变异。此时中介效应也就只存在在组间水平。

实例操练

多水平中介分析又可以有很多的情况了,各个水平可以自由搭配,图片右边便是一个211模型的路径图:

本文依然是展示一个最常用的211模型的做法:

我现在有长数据大概长这样,有变量mxy共3个变量,其中有cluster变量为“组”的识别码,其中x是高水平变量:

这个数据就是一个嵌套数据,每一个个案都嵌套在cluster变量中,我想要做一个211模型,我就可以写出代码如下:

model <- "
    level: 1
        y ~ b*m
    level: 2
        y ~ c*x
        m ~  a*x
    ab :=a*b
    total := ab+c
"
fit <- sem(model = model, data = data, cluster = "cluster")
summary(fit)

运行之后表可以得到间接效应的估计值和显著性:

代码的详细规则之前写lavaan结构方程模型的文章中应该是有介绍的,小伙伴可以找找。这儿的代码要注意的是,要弄明白变量关系的水平,因为我们的数据中x只有高水平的变异,所以一切与x的路径都应该放在level2中进行,那么其余的m和y的相应路径则可以根据研究目的合理分解。用多水平模型做中介的文章中一般都会在方法开始报告组内相关系数ICC:

As an initial step, the researcher should examine the extent to which clustering (or similarity among individuals) is present in the measures used to describe leadership effectiveness. This can help determine whether a multilevel analysis is in fact needed

这个在R中也可以很方便的得到,比如我们m和y变量都是低水平的数据,他们的嵌套程度究竟如何,运行下面的代码即可得到ICC:

lavInspect(fit, "icc")

其它的比如111模型221模型等等,都可以仿照上面做法。

猜你喜欢

转载自blog.csdn.net/tm_ggplot2/article/details/129188150