Skip to content

mediation() "Proportion mediated" estimate should be bound to 0-100 #690

@amynang

Description

@amynang

It's not the most essential aspect of the output but as it is the estimate for proportion mediated can have nonsensical intervals:

library(brms)
library(bayestestR)
library(piecewiseSEM)

data(keeley)

rich_bf <- 
  bf(rich ~ age + firesev) +
  bf(firesev ~ age) +
  set_rescor(FALSE)

rich_brms = brm(rich_bf,
                family = gaussian(),
                backend = "cmdstanr",
                chains = 4,
                iter = 4000,
                warmup = 2000,
                cores = 4,
                refresh = 0,
                data = keeley
)

mediation(rich_brms)
# Causal Mediation Analysis for Stan Model

Treatment: age
Mediator : firesev
Response : rich

Effect                 | Estimate |          95% ETI
----------------------------------------------------
Direct Effect (ADE)    |   -0.204 | [-0.471,  0.059]
Indirect Effect (ACME) |   -0.153 | [-0.305, -0.034]
Mediator Effect        |   -2.636 | [-4.610, -0.604]
Total Effect           |   -0.363 | [-0.610, -0.113]

Proportion mediated: 42.19% [-23.03%, 107.40%]
  • Package Version [0.14.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions