Learn R Programming

robmed (version 0.1.1)

fortify.testMediation: Convert (robust) mediation analysis results into a data frame for plotting

Description

Supplement the estimated coefficients with other useful information for informative visualization of the (robust) mediation analysis results. It is thereby possible to construct data frames for dot plots of selected coefficients, as well as density plots of the indirect effect.

Usage

# S3 method for bootTestMediation
fortify(model, data, method = c("dot", "density"),
  parm = c("c", "ab"), ...)

# S3 method for sobelTestMediation fortify(model, data, method = c("dot", "density"), parm = c("c", "ab"), level = 0.95, ...)

# S3 method for list fortify(model, data, ...)

Arguments

model

an object inheriting from class "testMediation" containing results from (robust) mediation analysis.

data

for the "bootTestMediation" method, this is currently ignored. For the "sobelTestMediation" method, this is an optional numeric vector containing the \(x\)-values at which to evaluate the assumed normal density from Sobel's test (only used in case of a density plot). The default is to take 100 equally spaced points between the estimated indirect effect \(\pm\) three times the standard error according to Sobel's formula.

method

a character string specifying for which plot to construct the data frame. Possible values are "dot" for a dot plot of selected coefficients, or "density" for a density plot of the indirect effect.

parm

a character string specifying the coefficients to be included in a dot plot. The default is to include the direct and the indirect effect.

level

numeric; the confidence level of the confidence intervals from Sobel's test to be included in a dot plot. The default is to include 95% confidence intervals.

additional arguments are currently ignored.

Value

A data frame containing the necessary data for the selected plot, as well as additional information stored in attributes.

See Also

testMediation, plotMediation