Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions posterior_database/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Self-Control and Performance While Working from Home

## Overview

This contribution implements a Bayesian hierarchical model based on:

Baumann, J., Danilov, A., & Stavrova, O. (2023). *Self-control and performance while working from home*. PLOS ONE, 18(4), e0282862.

https://doi.org/10.1371/journal.pone.0282862

The model reproduces the fully adjusted analysis (Model 2) from the original study using Stan.

## Data

The original dataset contains 786 observations from participants who completed three survey waves.

The data preparation follows the exclusion criteria of the original study:

- Removal of observations with missing ResponseId.
- Exclusion of participants who reported days off (`filter_days_off != 0`).
- Application of the two attention-check criteria (`attention_S1 = 3` and `attention_S2 = 3` and `attention_S3 = 3`).

After applying the exclusion criteria, 774 observations from 258 participants remained.

The variables used in the model were standardized using the means and standard deviations calculated after the exclusion criteria and before complete-case deletion.

Complete-case analysis resulted in a final dataset of **750 observations from 250 participants**, with three observations per participant.

The dataset includes work performance, time, self-control, demographic characteristics, working-from-home characteristics, and personality measures.

## Model

A Bayesian hierarchical linear model was implemented in Stan.

The model includes:

- Time.
- Self-control.
- The time-by-self-control interaction.
- Gender, age, children, income, and education.
- Share of working time spent working from home.
- The Big Five personality dimensions.

Participant-specific random intercepts and random time slopes are included, with a correlated covariance structure.

A non-centred parameterization is used for the hierarchical effects.

The model uses weakly informative normal priors for the fixed effects, half-normal priors for the standard deviation parameters, and an LKJ prior for the correlation structure.

The generated quantities include the correlation matrix and replicated performance observations.

## Posterior Sampling

Posterior inference was performed using RStan.

Sampling configuration:

| Setting | Value |
|---|---:|
| Chains | 4 |
| Iterations per chain | 3,500 |
| Warm-up iterations | 1,000 |
| Post-warm-up draws per chain | 2,500 |
| Total post-warm-up draws | 10,000 |
| Random seed | 1234 |
| Adapt delta | 0.95 |

## Computational Diagnostics

The sampling diagnostics indicate satisfactory convergence and sampling behaviour:

- No divergent transitions were observed.
- All E-BFMI values exceeded 0.2.
- All reported R-hat values were below 1.01.
- Minimum bulk effective sample size was approximately 1,947.
- Minimum tail effective sample size was approximately 3,937.

Some diagnostic values are unavailable for constant elements of the Cholesky factor.

## Reference Posterior Draws

The reduced reference posterior is provided as:

`reference_posteriors/draws/draws/self_control_wfh-work_performance_reduced.json.zip`

It contains:

- 522 sampled parameter variables.
- 4 chains.
- 2,500 post-warm-up draws per chain.
- 10,000 total draws.

The reduction retains the model parameters, including the key coefficients:

- `beta_time`
- `beta_self_control`
- `beta_interaction`

It also retains the participant-level latent variables and other sampled parameters.

Generated quantities, including `performance_rep`, `b`, and `Omega`, are excluded from the reduced reference draws. The observed outcome `performance` remains part of the data object.

## Validation Note

The reference posterior was checked using `posteriordb` version 0.3.6.

The standard `check_reference_posterior_draws()` function does not pass its ESS bounds assertion for these draws.

The package's internal ESS bounds require bulk and tail ESS values to fall within a narrow interval around the total number of draws. The observed ESS values do not satisfy this condition.

This failure should not be interpreted as evidence of poor convergence. The independent sampling diagnostics reported above show no divergences, E-BFMI values above 0.2, and R-hat values below 1.01.

The ESS validation limitation is disclosed rather than overridden. The corresponding `ess_within_bounds` check is recorded as `FALSE` in the reduced reference posterior metadata.

## Software

- RStan 2.39.0
- Stan 2.39.0
- posterior 1.7.0
- posteriordb 0.3.6

## Citation

Baumann, J., Danilov, A., & Stavrova, O. (2023). Self-control and performance while working from home. *PLOS ONE*, 18(4), e0282862.

https://doi.org/10.1371/journal.pone.0282862
12 changes: 12 additions & 0 deletions posterior_database/bibliography/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,15 @@ @article{crowder1978beta
abstract = {Summary A method is proposed for the regression analysis of proportions based on the Beta-binomial distribution.},
year = {1978}
}


@article{Baumann2023SelfControl,
author = {Baumann, Julia and Danilov, Anastasia and Stavrova, Olga},
title = {Self-control and performance while working from home},
journal = {PLOS ONE},
year = {2023},
volume = {18},
number = {4},
pages = {e0282862},
doi = {10.1371/journal.pone.0282862}
}
Binary file not shown.
11 changes: 11 additions & 0 deletions posterior_database/data/info/self_control_wfh.info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "self_control_wfh",
"title": "Self-control and performance while working from home",
"added_by": "Rahul Rehman",
"added_date": "2026-11-02",
"references": "Baumann2023SelfControl",
"description": "Model-ready data used to reproduce the fully adjusted Model 2 from Baumann, Danilov, and Stavrova (2023). The dataset contains 750 observations from 250 participants, with three observations per participant.",
"urls": "https://doi.org/10.1371/journal.pone.0282862",
"keywords": ["self-control", "work-from-home", "productivity", "hierarchical model"],
"data_file": "data/data/self_control_wfh.json"
}
16 changes: 16 additions & 0 deletions posterior_database/models/info/work_performance.info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "work_performance",
"title": "Bayesian hierarchical model of self-control and work performance",
"description": "Bayesian hierarchical normal model reproducing the fully adjusted Model 2 from Baumann, Danilov, and Stavrova (2023). Includes correlated participant-specific random intercepts and time slopes, a self-control-by-time interaction, and demographic, work-related, and Big Five covariates. Uses a non-centred parameterisation.",
"keywords": ["hierarchical model", "random intercept", "random slope", "self-control", "work-from-home", "productivity"],
"references": "Baumann2023SelfControl",
"urls": "https://doi.org/10.1371/journal.pone.0282862",
"model_implementations": {
"stan": {
"model_code": "models/stan/work_performance.stan",
"stan_version": ">=2.39.0"
}
},
"added_by": "Rahul Rehman",
"added_date": "2026-11-02"
}
159 changes: 159 additions & 0 deletions posterior_database/models/stan/work_performance.stan
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
data {
int<lower=1> N;
int<lower=1> J;

array[N] int<lower=1, upper=J> participant;

vector[N] performance;
vector[N] time;
vector[N] self_control;

vector[N] gender;
vector[N] age;
vector[N] children;
vector[N] income;
vector[N] education;
vector[N] share_wfh;

vector[N] extraversion;
vector[N] agreeableness;
vector[N] conscientiousness;
vector[N] neuroticism;
vector[N] openness;
}

parameters {

real alpha;

real beta_time;
real beta_self_control;
real beta_interaction;

real beta_gender;
real beta_age;
real beta_children;
real beta_income;
real beta_education;
real beta_share_wfh;

real beta_extraversion;
real beta_agreeableness;
real beta_conscientiousness;
real beta_neuroticism;
real beta_openness;

real<lower=0> sigma;

vector<lower=0>[2] sigma_b;

cholesky_factor_corr[2] L_Omega;

matrix[J, 2] z_b;
}

transformed parameters {

matrix[J, 2] b;

b =
(diag_pre_multiply(
sigma_b,
L_Omega
) * z_b')';
}

model {

// Priors

alpha ~ normal(0, 1);

beta_time ~ normal(0, 1);
beta_self_control ~ normal(0, 1);
beta_interaction ~ normal(0, 1);

beta_gender ~ normal(0, 1);
beta_age ~ normal(0, 1);
beta_children ~ normal(0, 1);
beta_income ~ normal(0, 1);
beta_education ~ normal(0, 1);
beta_share_wfh ~ normal(0, 1);

beta_extraversion ~ normal(0, 1);
beta_agreeableness ~ normal(0, 1);
beta_conscientiousness ~ normal(0, 1);
beta_neuroticism ~ normal(0, 1);
beta_openness ~ normal(0, 1);

sigma ~ normal(0, 1);

sigma_b ~ normal(0, 1);

L_Omega ~ lkj_corr_cholesky(2);

to_vector(z_b) ~ normal(0, 1);


// Likelihood

for (n in 1:N) {

real mu;

mu =
alpha
+ b[participant[n], 1]
+ beta_time * time[n]
+ b[participant[n], 2] * time[n]
+ beta_self_control * self_control[n]
+ beta_interaction
* time[n]
* self_control[n]
+ beta_gender * gender[n]
+ beta_age * age[n]
+ beta_children * children[n]
+ beta_income * income[n]
+ beta_education * education[n]
+ beta_share_wfh * share_wfh[n]
+ beta_extraversion * extraversion[n]
+ beta_agreeableness * agreeableness[n]
+ beta_conscientiousness * conscientiousness[n]
+ beta_neuroticism * neuroticism[n]
+ beta_openness * openness[n];

performance[n] ~ normal(mu, sigma);
}
}

generated quantities {
corr_matrix[2] Omega;
vector[N] performance_rep;

Omega = multiply_lower_tri_self_transpose(L_Omega);

for (n in 1:N) {
real mu;

mu =
alpha
+ b[participant[n], 1]
+ beta_time * time[n]
+ b[participant[n], 2] * time[n]
+ beta_self_control * self_control[n]
+ beta_interaction * time[n] * self_control[n]
+ beta_gender * gender[n]
+ beta_age * age[n]
+ beta_children * children[n]
+ beta_income * income[n]
+ beta_education * education[n]
+ beta_share_wfh * share_wfh[n]
+ beta_extraversion * extraversion[n]
+ beta_agreeableness * agreeableness[n]
+ beta_conscientiousness * conscientiousness[n]
+ beta_neuroticism * neuroticism[n]
+ beta_openness * openness[n];

performance_rep[n] = normal_rng(mu, sigma);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "self_control_wfh-work_performance",
"model_name": "work_performance",
"data_name": "self_control_wfh",
"reference_posterior_name": "self_control_wfh-work_performance",
"dimensions": [],
"added_by": "Rahul Rehman",
"added_date": "2026-11-02"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "self_control_wfh-work_performance_reduced",
"model_name": "work_performance",
"data_name": "self_control_wfh",
"reference_posterior_name": "self_control_wfh-work_performance_reduced",
"dimensions": [],
"added_by": "Rahul Rehman",
"added_date": "2026-11-02"
}
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.