Package: wsMed 1.1.0

Wendie Yang

wsMed: Within-Subject Mediation Analysis Using Structural Equation Modeling

Within-subject mediation analysis using structural equation modeling. Examine how changes in an outcome variable between two conditions are mediated through one or more variables. Supports within-subject mediation analysis using the 'lavaan' package by Rosseel (2012) <doi:10.18637/jss.v048.i02>, and extends Monte Carlo confidence interval estimation to missing data scenarios using the 'semmcci' package by Pesigan and Cheung (2023) <doi:10.3758/s13428-023-02114-4>.

Authors:Wendie Yang [aut, cre], Shu Fai Cheung [aut]

wsMed_1.1.0.tar.gz
wsMed_1.1.0.zip(r-4.7-any)wsMed_1.1.0.zip(r-4.6-any)wsMed_1.1.0.zip(r-4.5-any)
wsMed_1.1.0.tgz(r-4.6-any)wsMed_1.1.0.tgz(r-4.5-any)
wsMed_1.1.0.tar.gz(r-4.7-any)wsMed_1.1.0.tar.gz(r-4.6-any)
wsMed_1.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
wsMed/json (API)

# Install 'wsMed' in R:
install.packages('wsMed', repos = c('https://yangzhen1999.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/yangzhen1999/wsmed/issues

Pkgdown/docs site:https://yangzhen1999.github.io

On CRAN:

Conda:

mediation-analysismissing-datasemstandardizationwithin-subject

5.53 score 1 stars 17 scripts 243 downloads 16 exports 88 dependencies

Last updated from:2cec48839a. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK300
source / vignettesOK233
linux-releaseOK570
macos-releaseOK202
macos-oldrelOK164
windows-develOK308
windows-releaseOK248
windows-oldrelOK226
wasm-releaseOK143

Exports:GenerateModelCNGenerateModelCPGenerateModelCustomGenerateModelPGenerateModelPCImputeDataMCMI2plot_conditional_effectsplot_contrastsplot_effectsplot_moderation_curvePrepareDataPrepareMissingDataprintGMstandardize_moderationwsMed

Dependencies:backportsbitbit64bootbroomclicliprcodetoolscpp11crayondplyrevaluatefarverforcatsforeachgenericsGGallyggplot2ggstatsglmnetglueGPArotationgtablehavenhighrhmsisobanditeratorsjomoknitrlabelinglatticelavaanlavaan.printerlifecyclelme4magrittrMASSMatrixmiceminqamitmlmnormtnlmenloptrnnetnumDerivordinalpanpatchworkpbivnormpillarpkgconfigprettyunitsprogresspsychpurrrquadprogR6rbibutilsRColorBrewerRcppRcppEigenRdpackreadrreformulasrlangrpartS7scalessemboottoolssemmccishapestringistringrsurvivaltibbletidyrtidyselecttzdbucminfutf8vctrsviridisLitevroomwithrxfunyaml

Demonstration of printGM()
Using printGM() with WsMed() | Using printGM() with GenerateModel*()

Last update: 2026-09-18
Started: 2025-03-12

MEMORE_vs_wsMed
introduction | parallel mediation | MEMORE 3.0 Analysis Report | wsMed Analysis Report | chained/serial mediation

Last update: 2026-09-18
Started: 2025-03-12

User-defined mediation models with GenerateModelCustom
Introduction | Mediator numbering | Preparing example data | [M_ | Specifying a custom model | Indirect effects | GenerateModelCustom() identifies every directed path from a mediator to Y.The model above contains three indirect effects:[\mathtt | [\mathtt | [\mathtt | Parameter labels | Fitting the complete model with wsMed | Input requirements | Summary

Last update: 2026-09-18
Started: 2026-09-18

Using wsMed: A step-by-step tutorial
Introduction | Quick start | Step 1: Specify the repeated-measures variables | Step 2: Choose the mediation structure | Predefined models | User-defined models | Step 3: Choose the estimation options | Missing data and confidence intervals | Standardized effects | Step 4: Add optional model components | Moderators | Covariates | Step 5: Inspect the results | Step 6: Interpret the printed results | Example 1: A model without an external moderator | Variables and analysis sample | Model fit | Total, direct, and indirect effects | [\text | Level-component paths and condition-specific coefficients | Contrasts between indirect effects | Regression paths, intercepts, and variances | Standardized results | Inspecting and extracting Example 1 | Example 2: A model with a continuous moderator | Moderated coefficients | Conditional effects | Significance markers and confidence intervals | Visualizing conditional effects | What to report | Further model details | Summary

Last update: 2026-09-18
Started: 2024-12-27

GenerateModelCN
Introduction | 1. Difference Model Description | 1.1 Regression for ( Y_{\text{diff}} ) and ( M_{\text{diff}} ) | 2. Indirect Effects | 2.1 Examples of Indirect Effects | 3. Total Effect | 4. Comparison of Indirect Effects | 4.1 Comparing Indirect Effects | Interpretation: | 4.2 Example: Three Mediators ( M_1, M_2, M_3 ) | Indirect Effects | Comparisons | The indirect effects are compared as follows:[CI_{1\text{vs}2} = \text{indirect}1 - \text{indirect}2][CI{1\text{vs}3} = \text{indirect}1 - \text{indirect}3][CI{2\text{vs}3} = \text{indirect}2 - \text{indirect}3][CI{1\text{vs}12} = \text{indirect}1 - \text{indirect}{12}][CI{1\text{vs}23} = \text{indirect}1 - \text{indirect}{23}][CI{1\text{vs}123} = \text{indirect}1 - \text{indirect}{123}][CI{2\text{vs}12} = \text{indirect}2 - \text{indirect}{12}][CI_{2\text{vs}23} = \text{indirect}2 - \text{indirect}{23}][CI_{2\text{vs}123} = \text{indirect}2 - \text{indirect}{123}][CI_{3\text{vs}12} = \text{indirect}3 - \text{indirect}{12}][CI_{3\text{vs}23} = \text{indirect}3 - \text{indirect}{23}][CI_{3\text{vs}123} = \text{indirect}3 - \text{indirect}{123}][CI_{12\text{vs}23} = \text{indirect}{12} - \text{indirect}{23}][CI_{12\text{vs}123} = \text{indirect}{12} - \text{indirect}{123}][CI_{23\text{vs}123} = \text{indirect}{23} - \text{indirect}{123}] | 5. C1 and C2 Coefficients | 6. Summary of Regression Equations

Last update: 2025-11-07
Started: 2024-12-09

GenerateModelCP
Introduction | 1. Model Description | 1.1 Regression for ( Y_{\text{diff}} ) and ( M_{\text{diff}} ) | 2. Indirect Effects | 3. Total Effect | 4. Comparison of Indirect Effects | 4.1 Example: Three Mediators (( M_1, M_2, M_3 )) | 5. C1 and C2 Coefficients | Definitions | 5.1 Example: Three Mediators (( M_1, M_2, M_3 )) | 6. Summary of Regression Equations

Last update: 2025-11-07
Started: 2024-12-09

GenerateModelP
Introduction | 1. Difference Model Description | 1.1 Regression for ( Y_1 ) and ( Y_2 ) | 1.2 Difference Model for ( Y_{\text{diff}} ) | 1.3 Regression for ( M_{\text{diff}} ) | 2. Indirect Effects | 3. Total Effect | 4. Comparison of Indirect Effects | 4.1 Indirect Effect Definition | 4.2 Comparing Indirect Effects | Interpretation | 5. C1- and C2-Measurement Coefficients | 5.1 Difference Model with Two Mediators | 5.2 C2-Measurement Coefficients | 5.3 C1-Measurement Coefficients | 6. Summary of Regression Equations | 6.1 Difference Model | 6.2 Defined parameters | Summary

Last update: 2025-11-07
Started: 2024-12-09

GenerateModelPC
Introduction | 1. Model Description | 1.1 Regression for ( Y_{\text{diff}} ) and ( M_{\text{diff}} ) | 2. Indirect Effects | 3. Total Effect | 4. Comparison of Indirect Effects | 4.1 Example: Three Mediators (( M_1, M_2, M_3 )) | 5. C1- and C2-Measurement Coefficients | Definitions | 5.1 Example: Three Mediators (( M_1, M_2, M_3 )) | 6. Summary of Regression Equations

Last update: 2025-11-07
Started: 2024-12-09