Paper:
Scarabusci, R., & Moneta, G. B. (submitted). Mindfulness and affect regulation: A pilot randomized trial in financially anxious individuals.
Abstract:
Financial anxiety has emerged as a significant psychological burden, yet no randomized controlled trials (RCTs) to date have evaluated mindfulness-based interventions in this population. This pilot RCT is the first to explore the feasibility and preliminary effects of mindfulness training for financially anxious individuals. Thirty-one participants were randomly assigned to either a mindfulness group or a waitlist control. Positive and negative affect were assessed pre- and post-intervention using the Positive and Negative Affect Schedule (PANAS). To account for emotional interdependence, data were analyzed with a multivariate Bayesian model, and simulation-based power analysis was conducted to estimate the sample size needed for a fully powered trial. Results revealed modest but consistent trends toward improved affect, particularly reductions in negative affect in the mindfulness group. Power analysis indicated that a sample size of N = 233 would be required to detect a group × time interaction on positive affect with 80% power. These findings demonstrate the feasibility of a larger trial and highlight the value of simultaneously modeling both affective dimensions when evaluating mindfulness interventions in populations vulnerable to perseverative thinking.
This section provides a fully reproducible Python script for analyzing affective changes over time using a mixed-effects multivariate model (MMLM). The dataset and script demonstrate how to:
· Reshape longitudinal data for MMLM analysis
· Specify a three-way interaction model (Group × Time × Affect)
· Include correlated residuals for positive affect (PA) and and negative affect NA using vc_formula
· Compare Python (statsmodels) with R (lme4) in MMLM modeling
The full dataset and annotated Python script are available for download below.
The dataset (MindVerticalAffect.csv) contains restructured affective data from a mindfulness intervention study, formatted for mixed-effects modeling.
Key variables:
· subnum → Participant ID
· Group → Experimental (0) vs. Control (1)
· Time → Pre (1) vs. Post (2)
· PA → Positive Affect score
· NA → Negative Affect score
Download the data:
· Dataset: MindVerticalAffect.csv
The full annotated Python script is available from below and includes:
· Data reshaping into long format (melt())
· Fixed effects for Group, Time, and Affect (Score ~ Group * Time * Affect)
Random slopes for Time (re_formula="1 + Time")
· Correlated residuals for PA and NA (vc_formula={"Affect": "0 + Affect"})
· Fitting the model with Powell optimization (method='powell')
Using vc_formula for correlated residuals:
· Unlike lme4 in R, which requires custom covariance structures, Python’s statsmodels allows easy modeling of correlated residuals for multiple outcome variables (PA & NA) using:
· vc_formula={"Affect": "0 + Affect"}
· This is useful when affective states are interdependent (e.g., high PA often coexists with low NA).
Why Python for MLM?
· statsmodels provides greater flexibility for specifying variance components
· More transparent model fitting compared to lme4's default optimizers
· Fully open-source & integrates well with Pandas and NumPy
==================================================================
Model: MixedLM Dependent Variable: Score
No. Observations: 124 Method: REML
No. Groups: 31 Scale: 0.2378
Min. group size: 4 Log-Likelihood: -135.6666
Max. group size: 4 Converged: Yes
Mean group size: 4.0
------------------------------------------------------------------
Coef. Std.Err. z P>|z| [0.025 0.975]
------------------------------------------------------------------
Intercept 4.667 0.726 6.428 0.000 3.244 6.090
Affect[T.PA] -2.429 1.027 -2.366 0.018 -4.442 -0.417
Group -0.933 0.455 -2.052 0.040 -1.825 -0.042
Group:Affect[T.PA] 1.596 0.643 2.481 0.013 0.335 2.856
Time -1.410 0.396 -3.565 0.000 -2.186 -0.635
Time:Affect[T.PA] 2.207 0.560 3.945 0.000 1.111 3.304
Group:Time 0.677 0.248 2.732 0.006 0.191 1.163
Group:Time:Affect[T.PA] -1.147 0.350 -3.274 0.001 -1.834 -0.461
Group Var 0.000 0.586
Group x Time Cov -0.000 0.405
Time Var 0.000 0.214
Affect Var 0.412 0.235
==================================================================
Note: The direction of these coefficients reflects the coding of the control group as 1, meaning that the treatment group experienced a greater reduction in NA and a greater increase in PA.
This repository contains all R scripts used to conduct the multivariate multilevel Bayesian simulation and power analysis for the Mindfulness and Affect RCT pilot study. The scripts allow replication of the full simulation workflow, including:
§ Simulation of synthetic data based on parameter estimates
§ Model fitting using brms and cmdstanr
§ Calculation of power across sample sizes
§ Logistic interpolation and plotting of the power curve
· Mindfulness_R_Simulation_Repository.zip
· simulate_brms_power.R — Core simulation function
· Supercode_31.R — Simulation run for N = 31
· Supercode_90.R — Simulation run for N = 90
· Supercode_120.R — Simulation run for N = 120
· Supercode_240.R — Simulation run for N = 240
· logistic_fit_plot.R — Logistic model and visualization of power curve
To run these scripts, ensure the following R packages are installed:
§ brms with cmdstanr backend
§ tidyverse
§ MASS
Note: The cmdstanr interface requires a working CmdStan installation. You can set it up using cmdstanr::install_cmdstan().
Feel free to use, modify, and share this script for your own analyses! If you reference this work, please cite:
📧 Scarabusci, R., & Moneta, G. B. (submitted). Mindfulness and affect regulation: A pilot randomized trial in financially anxious individuals.
📧 For questions, contact: g.moneta@londonmet.ac.uk