e1
, e2
, and e3
are not parameters, these are error terms in the path model. You may need to clarify your understanding of path notation (and may be structural equation modeling in general). These variables do need their parameters, the variances -- I will refer to them as $\psi_k, k=1, 2, 3$. You would also need the variance of x1
as the model parameter; I will denote it as $\phi_{11}$. These are the standard symbols in SEM notation. With that, we can have
# set up the model parameters and the sample size n
n <- 100
b1 <- 1
b2 <- 0.8
b3 <- -0.3
b4 <- 0.5
b5 <- 0.8
phi11 <- 1
psi1 <- 0.64
psi2 <- 0.49
psi3 <- 0.81
# simulate the data
x1 <- rnorm(n, sd=sqrt( phi11 ) )
x2 <- b1*x1 + rnorm(n, sd=sqrt(psi1) )
x3 <- b2*x2 + rnorm(n, sd=sqrt(psi2) )
y <- b5*x1 + b4*x2 + b3*x3 + rnorm(n, sd=sqrt(psi3) )