Skip to main content
some formatting
Source Link
gung - Reinstate Monica
  • 147.5k
  • 89
  • 406
  • 717

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$$\newcommand{\med}{\rm med} \med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The \begin{align} Y &= b_{11} + b_{12}X + e_1 \tag{1} \\ \med &= b_{21} + b_{22}X + e_2 \tag{2} \\ Y &= b_{31} + b_{32}X + b_{32} \med + e_3 \tag{3} \end{align} The indirect effect or mediation effect of $X$ on $Y$ through $med$$\med$ can either be defined as $b_{22}*b_{32}$$b_{22}b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$$\med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x   <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$$\med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach. This is important because one definition of the indirect (i.e., mediation) effect is $b_{12}-b_{32}$, as I describe above.

Can anyone help me find a procedure in R to generate variables $X$, $med$$\med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach. This is important because one definition of the indirect (i.e., mediation) effect is $b_{12}-b_{32}$, as I describe above.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $\newcommand{\med}{\rm med} \med$, and predictor $X$ and are governed by the following three regression equations: \begin{align} Y &= b_{11} + b_{12}X + e_1 \tag{1} \\ \med &= b_{21} + b_{22}X + e_2 \tag{2} \\ Y &= b_{31} + b_{32}X + b_{32} \med + e_3 \tag{3} \end{align} The indirect effect or mediation effect of $X$ on $Y$ through $\med$ can either be defined as $b_{22}b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $\med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x   <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $\med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach. This is important because one definition of the indirect (i.e., mediation) effect is $b_{12}-b_{32}$, as I describe above.

Can anyone help me find a procedure in R to generate variables $X$, $\med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

Tweeted twitter.com/#!/StackStats/status/388367281618960384
Added more clarifying text
Source Link

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach. This is important because one definition of the indirect (i.e., mediation) effect is $b_{12}-b_{32}$, as I describe above.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach. This is important because one definition of the indirect (i.e., mediation) effect is $b_{12}-b_{32}$, as I describe above.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

Clarified text
Source Link

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ using this approach.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

I am interested in finding a procedure to simulate data that are consistent with a specified mediation model. According to the general linear structural equation model framework for testing mediation models first outlined by Barron and Kenny (1986) and described elsewhere such as Judd, Yzerbyt, & Muller (2013), mediation models for outcome $Y$, mediator $med$, and predictor $X$ and are governed by the following three regression equations:

  1. $Y = b_{11} + b_{12}*X + e_1$
  2. $med = b_{21} + b_{22}*X + e_2$
  3. $Y = b_{31} + b_{32}*X + b_{32} * med + e_3$

The indirect effect or mediation effect of $X$ on $Y$ through $med$ can either be defined as $b_{22}*b_{32}$ or, equivalently, as $b_{12}-b_{32}$. Under the old framework of testing for mediation, mediation was established by testing $b_{12}$ in equation 1, $b_{22}$ in equation 2, and $b_{32}$ in equation 3.

So far, I have attempted to simulate values of $med$ and $Y$ that are consistent with values of the various regression coefficients using rnorm in R, such as the code below:

x <- rep(c(-.5, .5), 50)
med <- 4 + .7 * x + rnorm(100, sd = 1) 

# Check the relationship between x and med
mod <- lm(med ~ x)
summary(mod)

y <- 2.5 + 0 * x + .4 * med + rnorm(100, sd = 1)

# Check the relationships between x, med, and y
mod <- lm(y ~ x + med)
summary(mod)

# Check the relationship between x and y -- not present
mod <- lm(y ~ x)
summary(mod)

However, it seems that sequentially generating $med$ and $Y$ using equations 2 and 3 is not enough, since I am left with no relationship between $X$ and $Y$ in regression equation 1 (which models a simple bivariate relationship between $X$ and $Y$) using this approach.

Can anyone help me find a procedure in R to generate variables $X$, $med$, and $Y$ that satisfy constraints that I set using equations 1, 2, and 3?

added tags; removed thanks
Source Link
gung - Reinstate Monica
  • 147.5k
  • 89
  • 406
  • 717
Loading
Source Link
Loading