The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
GenerateModelP function dynamically generates a
Structural Equation Model (SEM) formula to analysis parallel mediation
for ‘lavaan’ based on the prepared dataset. This document explains the
mathematical principles and the structure of the generated model.
Taking the difference between the two conditions: \[ Y_{\text{diff}} = Y_2 - Y_1 = (b_{20} - b_{10}) + \sum_{i=1}^N b_{i2} M_{i2} - \sum_{i=1}^N b_{i1} M_{i1} + (e_2 - e_1) \]
Define: - \(\Delta b_0 = b_{20} - b_{10}\): Difference in intercepts. - \(e = e_2 - e_1\): Difference in residuals.
Substitute mediator difference and average: 1. Mediator difference: \[ M_{\text{diff},i} = M_{i2} - M_{i1} \]
Substitute \(M_{i2} = M_{\text{avg},i} + \frac{M_{\text{diff},i}}{2}\) and \(M_{i1} = M_{\text{avg},i} - \frac{M_{\text{diff},i}}{2}\) into the equation: \[ Y_{\text{diff}} = \Delta b_0 + \sum_{i=1}^N \left( \frac{b_{i1} + b_{i2}}{2} \cdot M_{\text{diff},i} + (b_{i2} - b_{i1}) \cdot M_{\text{avg},i} \right) + e \]
Define: - \(b_i = \frac{b_{i1} + b_{i2}}{2}\): Average effect of the \(i\)-th mediator. - \(d_i = b_{i2} - b_{i1}\): Difference in the effect of the \(i\)-th mediator.
The final equation becomes: \[ Y_{\text{diff}} = \Delta b_0 + \sum_{i=1}^N \left( b_i M_{\text{diff},i} + d_i M_{\text{avg},i} \right) + e \]
Each mediator difference \(M_{\text{diff},i}\) is modeled as: \[ M_{\text{diff},i} = a_i + \epsilon_i \]
Where: - \(a_i\): Intercept term for the \(i\)-th mediator difference. - \(\epsilon_i\): Residual for \(M_{\text{diff},i}\).
For each mediator \(M_i\), the indirect effect is defined as: \[ \text{indirect}_i = a_i \cdot b_i \]
Where: - \(a_i\): Effect of the independent variable on mediator \(M_i\). - \(b_i\): Average effect of mediator \(M_i\) on the dependent variable.
The total indirect effect is: \[ \text{total_indirect} = \sum_{i=1}^N \text{indirect}_i \]
The contrast between indirect effects of two mediators \(M_i\) and \(M_j\) is: \[ CI_{i,j} = \text{indirect}_i - \text{indirect}_j \]
The total effect combines the direct effect and the total indirect effect: \[ \text{total_effect} = c_p + \text{total_indirect} \]
Where \(c_p\) is the direct effect of the independent variable on the dependent variable.
When there are multiple mediators (\(M_1, M_2, \dots, M_N\)), comparing their indirect effects provides insights into the relative influence of each mediator. This section details the formulas and interpretations for such comparisons.
For a mediator \(M_i\), the indirect effect is defined as: \[ \text{indirect}_i = a_i \cdot b_i \]
Where: - \(a_i\): Effect of the independent variable on mediator \(M_i\). - \(b_i\): Average effect of mediator \(M_i\) on the dependent variable.
To compare the indirect effects of two mediators \(M_i\) and \(M_j\), we calculate the contrast: \[ CI_{i,j} = \text{indirect}_i - \text{indirect}_j \]
To compute C1- and C2-measurement coefficients \(X1_{b,i}\) and \(X0_{b,i}\), consider two mediators \(M_1\) and \(M_2\):
From the difference model: \[ Y_{\text{diff}} = \Delta b_0 + \left(\frac{b_{11} + b_{21}}{2}\right) M_{\text{diff}} + \left(b_{21} - b_{11}\right) M_{\text{avg}} + e \]
Define: - \(b = \frac{b_{11} + b_{21}}{2}\): Average effect. - \(d = b_{21} - b_{11}\): Difference in effect.
The C2-measurement coefficient \(X1_{b,i}\) is defined as: \[ X1_{b,i} = b + d \]
Substitute \(b\) and \(d\): \[ X1_{b,i} = \frac{b_{11} + b_{21}}{2} + (b_{21} - b_{11}) = b_{21} \]
Thus, \(X1_{b,i}\) is the effect of \(M_i\) under Condition 2.
The C1-measurement coefficient \(X0_{b,i}\) is defined as: \[ X0_{b,i} = X1_{b,i} - d \]
Substitute \(X1_{b,i} = b_{21}\) and \(d = b_{21} - b_{11}\): \[ X0_{b,i} = b_{21} - (b_{21} - b_{11}) = b_{11} \]
Thus, \(X0_{b,i}\) is the effect of \(M_i\) under Condition 1.
Additional Interpretation: The coefficient \(d_i = b_{2i} - b_{1i}\) reflects the moderating effect of the within-subject variable X, capturing how the mediator’s influence differs across conditions.
This section summarizes all the regression equations used in the analysis, including the difference model, indirect effects, mediator comparisons, and C1- and C2-measurement coefficients.
\[ Y_{\text{diff}} = cp + \sum_{i=1}^N \left( b_i M_{\text{diff},i} + d_i M_{\text{avg},i} \right) + e \]
\[ M_{\text{diff},i} = a_i + \epsilon_i \]
\[ \text{indirect}_i = a_i \cdot b_i \]
\[ \text{total_indirect} = \sum_{i=1}^N \text{indirect}_i \]
\[ CI_{i,j} = \text{indirect}_i - \text{indirect}_j \]
\[ X1_{b,i} = b_i + d_i \]
\[ X0_{b,i} = X1_{b,i} - d_i \]
By combining these equations: 1. The difference model \(Y_{\text{diff}}\) decomposes into contributions from mediator differences (\(M_{\text{diff}}\)) and averages (\(M_{\text{avg}}\)). 2. Indirect effects and their contrasts provide insights into the mediators’ relative importance. 3. C1- and C2-measurement coefficients quantify the effects in specific conditions.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.