Learn R Programming

sjstats (version 0.17.7)

mediation: Summary of Bayesian multivariate-response mediation-models

Description

mediation() is a short summary for multivariate-response mediation-models.

Usage

mediation(x, ...)

# S3 method for brmsfit mediation(x, treatment, mediator, prob = 0.9, typical = "median", ...)

Arguments

x

A stanreg, stanfit, or brmsfit object.

...

Not used.

treatment

Character, name of the treatment variable (or direct effect) in a (multivariate response) mediator-model. If missing, mediation() tries to find the treatment variable automatically, however, this may fail.

mediator

Character, name of the mediator variable in a (multivariate response) mediator-model. If missing, mediation() tries to find the treatment variable automatically, however, this may fail.

prob

Vector of scalars between 0 and 1, indicating the mass within the credible interval that is to be estimated.

typical

The typical value that will represent the Bayesian point estimate. By default, the posterior median is returned. See typical_value for possible values for this argument.

Value

A data frame with direct, indirect, mediator and total effect of a multivariate-response mediation-model, as well as the proportion mediated. The effect sizes are mean values of the posterior samples.

Details

mediation() returns a data frame with information on the direct effect (mean value of posterior samples from treatment of the outcome model), mediator effect (mean value of posterior samples from mediator of the outcome model), indirect effect (mean value of the multiplication of the posterior samples from mediator of the outcome model and the posterior samples from treatment of the mediation model) and the total effect (mean value of sums of posterior samples used for the direct and indirect effect). The proportion mediated is the indirect effect divided by the total effect.

For all values, the 90% HDIs are calculated by default. Use prob to calculate a different interval.

The arguments treatment and mediator do not necessarily need to be specified. If missing, mediation() tries to find the treatment and mediator variable automatically. If this does not work, specify these variables.