Type: | Package |
Title: | Indirect Effects Testing Methods in Mediation Analysis |
Version: | 2.0 |
Date: | 2025-03-31 |
Maintainer: | John Kidd <jkidd@uvu.edu> |
Description: | Used in testing if the indirect effect from linear regression mediation analysis is equal to 0. Includes established methods such as the Sobel Test, Joint Significant test (maxP), and tests based off the distribution of the Product or Normal Random Variables. Additionally, this package adds more powerful tests based on Intersection-Union theory. These tests are the S-Test, the ps-test, and the ascending squares test. These new methods are uniformly more powerful than maxP, which is more powerful than Sobel and less anti-conservative than the Product of Normal Random Variables. These methods are explored by Kidd and Lin, (2024) <doi:10.1007/s12561-023-09386-6> and Kidd et al., (2025) <doi:10.1007/s10260-024-00777-7>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Depends: | R (≥ 3.3.0), grDevices, graphics, methods, stats, utils |
Imports: | Rcpp (≥ 1.0.3), RcppArmadillo, RcppDist, twosamples, MASS |
LinkingTo: | Rcpp, RcppArmadillo, RcppDist |
RoxygenNote: | 7.3.2 |
Encoding: | UTF-8 |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
NeedsCompilation: | yes |
Packaged: | 2025-03-31 21:48:21 UTC; 10975067 |
Author: | John Kidd [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-04-02 09:00:11 UTC |
ASQ-Test for the indirect effect - Single mediator path
Description
This function takes a vector of significance levels, as well as estimates and covariances, or 2 U values, for the asq-test for either one mediator of one path of an unordered mediation scenario. If estimates are passed to the function, the user must specify what distribution is to be used to find the cumulative probabilities. The smallest significance level for which the test is significant is returned, or 1 if no provided levels are significant. Additionally, the cutoff, either specified by number of squares or the percentage towards the center of the transformation region, can be specified.
Usage
asq_one(
alpha,
u1 = NULL,
u2 = NULL,
V1Dist = NULL,
V1 = NULL,
V1_VAR = NULL,
V1_DF = NULL,
V2Dist = NULL,
V2 = NULL,
V2_VAR = NULL,
V2_DF = NULL,
V2b = 0,
V2b_VAR = 0,
V2bmult = 1L,
V1_V2_cov = 0,
V1_V2b_cov = 0,
V2_V2b_cov = 0,
V1_0 = 0,
V2_0 = 0,
V2b_0 = 0,
numSquares = 4L,
upLim = 0.5
)
Arguments
alpha |
Significance levels to be tested. |
u1 , u2 |
The U values to be used in the test. Given priority over estimates, but both must be supplied. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1 |
Value of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1_VAR |
Value of the variance of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1_DF |
Degrees of freedom for V1. Only needed if t-distribution is used. |
V2Dist |
String value specifying the distribution of the estimate of the mediator (and interaction term) on the response. |
V2 |
Value of the estimate of the mediator on the response. Ignored if u1 and u2 are supplied. |
V2_VAR |
Value of the variance of the estimate of the mediator on the response.. Ignored if u1 and u2 are supplied. |
V2_DF |
Degrees of freedom for V2. Only needed if t-distribution is used.. |
V2b |
Value of the estimate of the effect of the interaction of the independent and mediator variable on the response. Ignored if u1 and u2 are supplied. |
V2b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and mediator variable on the response. Ignored if u1 and u2 are supplied. |
V2bmult |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
V1_V2_cov |
Value of the covariance between V1 and V2. Typically 0 for fully observed data. |
V1_V2b_cov |
Value of the covariance between V1 and V2b. Typically 0 for fully observed data. |
V2_V2b_cov |
Value of the covariance between V2 and V2b. |
V1_0 |
Null value for V1. |
V2_0 |
Null value for V2. |
V2b_0 |
Null value for V2b. |
numSquares |
The number of squares to be used in the asq-test. Always superseded by upLim. |
upLim |
The allowed extension, between 0 and 1, of the squares towards the center of the region |
Value
The smallest significance level that would reject the null hypothesis.
Examples
asq_one(c(.05, .01, .001), u1 = .02, u2= .015, upLim = .55)
ASQ-Test for the indirect effect - Ordered Mediators
Description
This function takes a vector of significance levels, as well as estimates and covariances, or 3 U values, for the asq-test for an ordered mediation scenario. If estimates are passed to the function, the user must specify what distribution is to be used to find the cumulative probabilities. The smallest significance level for which the test is significant is returned, or 1 if no provided levels are significant. Additionally, the cutoff, either specified by number of squares or the percentage towards the center of the transformation region, can be specified.
Usage
asq_ord(
alpha,
u1 = NULL,
u2 = NULL,
u3 = NULL,
V1Dist = NULL,
V1 = NULL,
V1_VAR = NULL,
V1_DF = NULL,
V2Dist = NULL,
V2 = NULL,
V2_VAR = NULL,
V2_DF = NULL,
V2b = 0,
V2b_VAR = 0,
V2bmult = 1L,
V3Dist = NULL,
V3 = NULL,
V3_VAR = NULL,
V3_DF = NULL,
V3b = 0,
V3b_VAR = 0,
V1_V2_cov = 0,
V1_V2b_cov = 0,
V1_V3_cov = 0,
V1_V3b_cov = 0,
V2_V2b_cov = 0,
V2_V3_cov = 0,
V2_V3b_cov = 0,
V2b_V3_cov = 0,
V2b_V3b_cov = 0,
V3_V3b_cov = 0,
V1_0 = 0,
V2_0 = 0,
V2b_0 = 0,
V3_0 = 0,
V3b_0 = 0,
numSquares = 4L,
upLim = 0.5
)
Arguments
alpha |
Significance levels to be tested. |
u1 , u2 , u3 |
The U values to be used in the test. Given priority over estimates, but all must be supplied. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1 |
Value of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1_VAR |
Value of the variance of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1_DF |
Degrees of freedom for V1. Only needed if t-distribution is used. |
V2Dist |
String value specifying the distribution of the estimate of the first mediator (and interaction term) on the second mediator. |
V2 |
Value of the estimate of the first mediator on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2_VAR |
Value of the variance of the estimate of the first mediator on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2_DF |
Degrees of freedom for V2. |
V2b |
Value of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2bmult |
Value indicating the value of the independent variable used for the interactions. Typically 1. |
V3Dist |
String value specifying the distribution of the estimate of the second mediator (and interaction term) on the response. |
V3 |
Value of the estimate of the second mediator on the response. Ignored if u1, u2, and u3 are supplied. |
V3_VAR |
Value of the variance of the estimate of the second mediator on the response. Ignored if u1, u2, and u3 are supplied. |
V3_DF |
Degrees of freedom for V3. |
V3b |
Value of the estimate of the effect of the interaction of the independent and second mediator variable on the response. Ignored if u1, u2, and u3 are supplied. |
V3b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and second mediator variable on the response. Ignored if u1, u2, and u3 are supplied. |
V1_V2_cov |
Value of the covariance between V1 and V2. Typically 0 for fully observed data. |
V1_V2b_cov |
Value of the covariance between V1 and V2b. Typically 0 for fully observed data. |
V1_V3_cov |
Value of the covariance between V1 and V3. Typically 0 for fully observed data. |
V1_V3b_cov |
Value of the covariance between V1 and V3b. Typically 0 for fully observed data. |
V2_V2b_cov |
Value of the covariance between V2 and V2b. |
V2_V3_cov |
Value of the covariance between V2 and V3. Typically 0 for fully observed data. |
V2_V3b_cov |
Value of the covariance between V2 and V3b. Typically 0 for fully observed data. |
V2b_V3_cov |
Value of the covariance between V2b and V3. Typically 0 for fully observed data. |
V2b_V3b_cov |
Value of the covariance between V2b and V3b. Typically 0 for fully observed data. |
V3_V3b_cov |
Value of the covariance between V3 and V3b. |
V1_0 |
Null value for V1. |
V2_0 |
Null value for V2. |
V2b_0 |
Null value for V2b. |
V3_0 |
Null value for V3. |
V3b_0 |
Null value for V3b. |
numSquares |
The number of squares to be used in the asq-test. Always superseded by upLim. |
upLim |
The allowed extension, between 0 and 1, of the squares towards the center of the region |
Value
The smallest significance level that would reject the null hypothesis.
Examples
asq_ord(c(.05, .01, .001), u1 = .02, u2= .015, u3 = .995, upLim = .55)
Is the mediation effect significant?
Description
This function takes 3 U values for the asq-test for 2 ordered mediators, as well as an alpha level. It returns whether the test would reject at the given alpha level. Additionally, the cutoff, either specified by number of squares or the percentage towards the center of the transformation region, can be specified. This function is primarily called by the asq_ord function to determine if the test is significant at one of a chosen set of alpha values.
Usage
asq_ord_bool(alpha, u1, u2, u3, numSquares = 4L, upLim = 0.5)
Arguments
alpha |
Significance level for the test. |
u1 , u2 , u3 |
The U values to be used in the test |
numSquares |
The number of squares to be used in the asq-test. Always superceded by upLim |
upLim |
The allowed extension, between 0 and 1, of the squares towards the center of the region |
Value
A boolean variable indicating if the indirect effect null hypothesis is rejected.
Examples
asq_ord_bool(.05, .02, .015, .995, upLim = .75)
Testing the indirect effect.
Description
This function takes a vector estimates and a matrix of covariances or a vector of U values to be used in various indirect effect tests. Estimate vectors with three parameters will default to single mediator analysis (or one path of unordered mediation), and five parameters will default to the ordered scenario. Values for the interaction term must be provided for this wrapper. The user can then specify the distribution(s) to be used as well as the test to be performed.
Usage
ieTest(
test,
u = NULL,
V = NULL,
cov = NULL,
df = NULL,
V_0 = 0,
V1Dist = NULL,
V2Dist = NULL,
V3Dist = NULL,
numSquares = 10,
upLim = 0.5,
alpha = 0.05,
interMult = 1
)
Arguments
test |
Denotes the test to be performed. ("maxP", "ps-test", "asq-test", "sobel", "sobel unordered") |
u |
A vector with the U values to be used in the test. Given priority over estimates, but all must be supplied. Order defined in note. |
V |
A vector containing the estimates to be used in the test. Must follow same order as u. |
cov |
A matrix of the covariance matrix of the estimates in V. Must be square with dimensions compatible with V. Must follow same order as u. |
df |
A vector of the degrees of freedom for the effect estimates. Length of 2 for single mediator, 3 for ordered. |
V_0 |
A vector containing the null values of the estimates to be used in the test. Defaults to zero. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the mediator. |
V2Dist |
String value specifying the distribution of the second estimate. |
V3Dist |
String value specifying the distribution of the third estimate (only needed for ordered scenario). |
numSquares |
The number of squares to be used in the asq-test. Always superseded by upLim. |
upLim |
The allowed extension, between 0 and 1, for the asq and ps-tests. |
alpha |
A vector for the asq-test of significance levels to test. A value in the ps-test to control type I error. |
interMult |
Integer indicating the level of the independent variable to use for the interaction terms. |
Value
A p-value or p-value cutoff for the specified test for the indirect effect.
Note
Order of parameters Values must be in the correct order within u, V, and the cov matrix.
Single mediator (or single path in unordered scenarios):
Independent variable to mediator, mediator to response,
interaction of independent and mediator.
Ordered mediators:
Independent variable to first mediator,
first mediator to second mediator, interaction of independent and first mediator on second mediator,
second mediator to response, interaction of independent and second mediator on response.
Combined Unordered Mediator:
Independent variable to first mediator,
first mediator to response, interaction of independent and first mediator on response,
Independent variable to second mediator,
second mediator to response, interaction of independent and second mediator on response.
Examples
ieTest( test = "ps-test", u = c(.015, .02, .998), alpha = 0.05, upLim = 0.5)
Indirect Effects Testing methods in Mediation Analysis
Description
A package to provide a multitude of methods used in testing if the indirect effect from linear regression mediation analysis is equal to 0. Includes established methods such as the Sobel test, joint-significanct test (maxP), and test based off the distribution of the product or normal random variables. A modification of the Sobel test by Aroian is also provided. Additionally, this packed addes more powerful tests based on intersection-union theory. These tests are the S-test, the modified S-test, and the ascending squares test. These new methods are uniformly more powerful than maxP, which is more powerful than Sobel and less anti-conservative than the product of normal random variables.
Details
Functions should be used to test a hypothesis that the indirect effect is equal to zero. Alternate hypothesis values for individual effects can be specified. Functions are provided for one and two mediator scenarios.
Test methods for one mediator and two ordered (sequential) mediators are provided for all above mentioned methods except the S-test. The S-test has logically falacies defined in (cited paper), and thus extensions to two mediators have not been conducted. In unordered (simultaneous) mediator scenarios, two mediation affects (one through each mediator) can be determined. Single mediator approaches should be used in these circumstances. For the methods defined by Sobel and Aroian, an overall test for a mediation affect exists using a sumation.
Single mediator function names are in the format of "test_one". For ordered/sequential approaches, functions are named "test_two_seq". The two unordered approaches are called by "sobelTest_two_sim" and "aroian_two_sim".
Author(s)
John Kidd
Maintainer: John Kidd <jkidd@uvu.edu>
References
Kidd, J., Howard, A.G., Highland, H.M. et al. Hypothesis tests of indirect effects for multiple mediators. Stat Methods Appl, 2025.
Kidd, J., Lin, DY. Improving the Power to Detect Indirect Effects in Mediation Analysis. Stat Biosci, 2025.
MaxP test for the indirect effect - Single mediator path
Description
This function takes estimates and covariances, or 2 U values, for the maxP test for either one mediator of one path of an unordered mediation scenario. If estimates are passed to the function, the user must specify what distribution is to be used to find the cumulative probabilities. The maximum p-value is returned.
Usage
maxp_one(
u1 = NULL,
u2 = NULL,
V1Dist = NULL,
V1 = NULL,
V1_VAR = NULL,
V1_DF = NULL,
V2Dist = NULL,
V2 = NULL,
V2_VAR = NULL,
V2_DF = NULL,
V2b = 0,
V2b_VAR = 0,
V2bmult = 1L,
V1_V2_cov = 0,
V1_V2b_cov = 0,
V2_V2b_cov = 0,
V1_0 = 0,
V2_0 = 0,
V2b_0 = 0
)
Arguments
u1 , u2 |
The U values to be used in the test. Given priority over estimates, but both must be supplied. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1 |
Value of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1_VAR |
Value of the variance of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1_DF |
Degrees of freedom for V1. Only needed if t-distribution is used. |
V2Dist |
String value specifying the distribution of the estimate of the mediator (and interaction term) on the response. |
V2 |
Value of the estimate of the mediator on the response. Ignored if u1 and u2 are supplied. |
V2_VAR |
Value of the variance of the estimate of the mediator on the response.. Ignored if u1 and u2 are supplied. |
V2_DF |
Degrees of freedom for V2. Only needed if t-distribution is used.. |
V2b |
Value of the estimate of the effect of the interaction of the independent and mediator variable on the response. Ignored if u1 and u2 are supplied. |
V2b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and mediator variable on the response. Ignored if u1 and u2 are supplied. |
V2bmult |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
V1_V2_cov |
Value of the covariance between V1 and V2. Typically 0 for fully observed data. |
V1_V2b_cov |
Value of the covariance between V1 and V2b. Typically 0 for fully observed data. |
V2_V2b_cov |
Value of the covariance between V2 and V2b. |
V1_0 |
Null value for V1. |
V2_0 |
Null value for V2. |
V2b_0 |
Null value for V2b. |
Value
The p-value of the test in the form of the larger of the p-values for the individual parameters.
Examples
maxp_one(u1 = .02, u2= .015)
MaxP-Test for the indirect effect - Ordered Mediators
Description
This function takes estimates and covariances, or 3 U values, for the maxp-test for an ordered mediation scenario. If estimates are passed to the function, the user must specify what distribution is to be used to find the cumulative probabilities. The p-value of the maxp-test is returned.
Usage
maxp_ord(
u1 = NULL,
u2 = NULL,
u3 = NULL,
V1Dist = NULL,
V1 = NULL,
V1_VAR = NULL,
V1_DF = NULL,
V2Dist = NULL,
V2 = NULL,
V2_VAR = NULL,
V2_DF = NULL,
V2b = 0,
V2b_VAR = 0,
V2bmult = 1L,
V3Dist = NULL,
V3 = NULL,
V3_VAR = NULL,
V3_DF = NULL,
V3b = 0,
V3b_VAR = 0,
V1_V2_cov = 0,
V1_V2b_cov = 0,
V1_V3_cov = 0,
V1_V3b_cov = 0,
V2_V2b_cov = 0,
V2_V3_cov = 0,
V2_V3b_cov = 0,
V2b_V3_cov = 0,
V2b_V3b_cov = 0,
V3_V3b_cov = 0,
V1_0 = 0,
V2_0 = 0,
V2b_0 = 0,
V3_0 = 0,
V3b_0 = 0
)
Arguments
u1 , u2 , u3 |
The U values to be used in the test. Given priority over estimates, but all must be supplied. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1 |
Value of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1_VAR |
Value of the variance of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1_DF |
Degrees of freedom for V1. Only needed if t-distribution is used. |
V2Dist |
String value specifying the distribution of the estimate of the first mediator (and interaction term) on the second mediator. |
V2 |
Value of the estimate of the first mediator on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2_VAR |
Value of the variance of the estimate of the first mediator on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2_DF |
Degrees of freedom for V2. |
V2b |
Value of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2bmult |
Value indicating the value of the independent variable used for the interactions. Typically 1. |
V3Dist |
String value specifying the distribution of the estimate of the second mediator (and interaction term) on the response. |
V3 |
Value of the estimate of the second mediator on the response. Ignored if u1, u2, and u3 are supplied. |
V3_VAR |
Value of the variance of the estimate of the second mediator on the response. Ignored if u1, u2, and u3 are supplied. |
V3_DF |
Degrees of freedom for V3. |
V3b |
Value of the estimate of the effect of the interaction of the independent and second mediator variable on the response. Ignored if u1, u2, and u3 are supplied. |
V3b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and second mediator variable on the response. Ignored if u1, u2, and u3 are supplied. |
V1_V2_cov |
Value of the covariance between V1 and V2. Typically 0 for fully observed data. |
V1_V2b_cov |
Value of the covariance between V1 and V2b. Typically 0 for fully observed data. |
V1_V3_cov |
Value of the covariance between V1 and V3. Typically 0 for fully observed data. |
V1_V3b_cov |
Value of the covariance between V1 and V3b. Typically 0 for fully observed data. |
V2_V2b_cov |
Value of the covariance between V2 and V2b |
V2_V3_cov |
Value of the covariance between V2 and V3 Typically 0 for fully observed data. |
V2_V3b_cov |
Value of the covariance between V2 and V3b Typically 0 for fully observed data. |
V2b_V3_cov |
Value of the covariance between V2b and V3. Typically 0 for fully observed data. |
V2b_V3b_cov |
Value of the covariance between V2b and V3b Typically 0 for fully observed data. |
V3_V3b_cov |
Value of the covariance between V3 and V3b. |
V1_0 |
Null value for V1. |
V2_0 |
Null value for V2. |
V2b_0 |
Null value for V2b. |
V3_0 |
Null value for V3. |
V3b_0 |
Null value for V3b. |
Value
The p-value of the test in the form of the larger of the p-values for the individual parameters.
Examples
maxp_ord( u1 = .02, u2= .015, u3 = .995)
PS-Test for the indirect effect - Single mediator path
Description
This function takes estimates and covariances, or 2 U values, for the ps-test for either one mediator of one path of an unordered mediation scenario. If estimates are passed to the function, the user must specify what distribution is to be used to find the cumulative probabilities. The p-value of the ps-test is returned. Additionally, the cutoff, specified by the percentage towards the center of the transformation region, can be specified.
Usage
ps_one(
u1 = NULL,
u2 = NULL,
V1Dist = NULL,
V1 = NULL,
V1_VAR = NULL,
V1_DF = NULL,
V2Dist = NULL,
V2 = NULL,
V2_VAR = NULL,
V2_DF = NULL,
V2b = 0,
V2b_VAR = 0,
V2bmult = 1L,
V1_V2_cov = 0,
V1_V2b_cov = 0,
V2_V2b_cov = 0,
V1_0 = 0,
V2_0 = 0,
V2b_0 = 0,
upLim = 0.5,
alpha = NULL
)
Arguments
u1 , u2 |
The U values to be used in the test. Given priority over estimates, but both must be supplied. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1 |
Value of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1_VAR |
Value of the variance of the estimate of the independent variable on the mediator. Ignored if u1 and u2 are supplied. |
V1_DF |
Degrees of freedom for V1. Only needed if t-distribution is used. |
V2Dist |
String value specifying the distribution of the estimate of the mediator (and interaction term) on the response. |
V2 |
Value of the estimate of the mediator on the response. Ignored if u1 and u2 are supplied. |
V2_VAR |
Value of the variance of the estimate of the mediator on the response.. Ignored if u1 and u2 are supplied. |
V2_DF |
Degrees of freedom for V2. Only needed if t-distribution is used.. |
V2b |
Value of the estimate of the effect of the interaction of the independent and mediator variable on the response. Ignored if u1 and u2 are supplied. |
V2b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and mediator variable on the response. Ignored if u1 and u2 are supplied. |
V2bmult |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
V1_V2_cov |
Value of the covariance between V1 and V2. Typically 0 for fully observed data. |
V1_V2b_cov |
Value of the covariance between V1 and V2b. Typically 0 for fully observed data. |
V2_V2b_cov |
Value of the covariance between V2 and V2b. |
V1_0 |
Null value for V1. |
V2_0 |
Null value for V2. |
V2b_0 |
Null value for V2b. |
upLim |
The allowed extension, between 0 and 1, of the band towards the center of the region |
alpha |
Used to ensure correctly controlled type I error for large values of upLim. |
Value
The smallest alpha value for which the generated rejection region leads to rejection of the hypothesis test. Can be used as a p-value.
Examples
ps_one(u1 = .02, u2= .015, upLim = .55)
PS-Test for the indirect effect - Ordered Mediators
Description
This function takes estimates and covariances, or 3 U values, for the ps-test for an ordered mediation scenario. If estimates are passed to the function, the user must specify what distribution is to be used to find the cumulative probabilities. The p-value of the ps-test is returned. Additionally, the cutoff, specified by the percentage towards the center of the transformation region, can be specified.
Usage
ps_ord(
u1 = NULL,
u2 = NULL,
u3 = NULL,
V1Dist = NULL,
V1 = NULL,
V1_VAR = NULL,
V1_DF = NULL,
V2Dist = NULL,
V2 = NULL,
V2_VAR = NULL,
V2_DF = NULL,
V2b = 0,
V2b_VAR = 0,
V2bmult = 1L,
V3Dist = NULL,
V3 = NULL,
V3_VAR = NULL,
V3_DF = NULL,
V3b = 0,
V3b_VAR = 0,
V1_V2_cov = 0,
V1_V2b_cov = 0,
V1_V3_cov = 0,
V1_V3b_cov = 0,
V2_V2b_cov = 0,
V2_V3_cov = 0,
V2_V3b_cov = 0,
V2b_V3_cov = 0,
V2b_V3b_cov = 0,
V3_V3b_cov = 0,
V1_0 = 0,
V2_0 = 0,
V2b_0 = 0,
V3_0 = 0,
V3b_0 = 0,
upLim = 0.5,
alpha = NULL
)
Arguments
u1 , u2 , u3 |
The U values to be used in the test. Given priority over estimates, but all must be supplied. |
V1Dist |
String value specifying the distribution of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1 |
Value of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1_VAR |
Value of the variance of the estimate of the independent variable on the first mediator. Ignored if u1, u2, and u3 are supplied. |
V1_DF |
Degrees of freedom for V1. Only needed if t-distribution is used. |
V2Dist |
String value specifying the distribution of the estimate of the first mediator (and interaction term) on the second mediator. |
V2 |
Value of the estimate of the first mediator on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2_VAR |
Value of the variance of the estimate of the first mediator on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2_DF |
Degrees of freedom for V2. |
V2b |
Value of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. Ignored if u1, u2, and u3 are supplied. |
V2bmult |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
V3Dist |
String value specifying the distribution of the estimate of the second mediator (and interaction term) on the response. |
V3 |
Value of the estimate of the second mediator on the response. Ignored if u1, u2, and u3 are supplied. |
V3_VAR |
Value of the variance of the estimate of the second mediator on the response. Ignored if u1, u2, and u3 are supplied. |
V3_DF |
Degrees of freedom for V3. |
V3b |
Value of the estimate of the effect of the interaction of the independent and second mediator variable on the response. Ignored if u1, u2, and u3 are supplied. |
V3b_VAR |
Value of the variance of the estimate of the effect of the interaction of the independent and second mediator variable on the response. Ignored if u1, u2, and u3 are supplied. |
V1_V2_cov |
Value of the covariance between V1 and V2. Typically 0 for fully observed data. |
V1_V2b_cov |
Value of the covariance between V1 and V2b. Typically 0 for fully observed data. |
V1_V3_cov |
Value of the covariance between V1 and V3. Typically 0 for fully observed data. |
V1_V3b_cov |
Value of the covariance between V1 and V3b. Typically 0 for fully observed data. |
V2_V2b_cov |
Value of the covariance between V2 and V2b |
V2_V3_cov |
Value of the covariance between V2 and V3 Typically 0 for fully observed data. |
V2_V3b_cov |
Value of the covariance between V2 and V3b Typically 0 for fully observed data. |
V2b_V3_cov |
Value of the covariance between V2b and V3. Typically 0 for fully observed data. |
V2b_V3b_cov |
Value of the covariance between V2b and V3b Typically 0 for fully observed data. |
V3_V3b_cov |
Value of the covariance between V3 and V3b. |
V1_0 |
Null value for V1. |
V2_0 |
Null value for V2. |
V2b_0 |
Null value for V2b. |
V3_0 |
Null value for V3. |
V3b_0 |
Null value for V3b. |
upLim |
The allowed extension, between 0 and 1, of the band towards the center of the region. |
alpha |
Used to ensure correctly controlled type I error for large values of upLim. |
Value
The smallest alpha value for which the generated rejection region leads to rejection of the hypothesis test. Can be used as a p-value.
Examples
ps_ord( u1 = .02, u2= .015, u3 = .995, upLim = .55)
S test for Indirect Effect for a single mediator
Description
This function takes the estimate of the effect of the independent variable on the mediator and the effect of the mediator on the effect as well as their variances and performs the S test. Alternative null hypothesis can be specified as well. Additionally, covariances of the parameters can be specified for cases involving missing data where the estimates may be correlated.
Usage
sTest_one(alpha, x1, s11, df1, x2, s22, df2, x10 = 0, x20 = 0, s12 = 0)
Arguments
alpha |
Significance level for the test of significance |
x1 |
Numeric value of the estimated first effect of interest |
s11 |
Numeric value of the estimated first effect variance |
df1 |
Degrees of freedom for estimate x1 |
x2 |
Numeric value of estimated second effect of interest |
s22 |
Numeric value of the estimated second effect variance |
df2 |
Degrees of freedom for estimate x2. Often the same as x1 |
x10 |
Optional numeric value of alternative null hypothesis value for the first effect |
x20 |
Optional numeric value of alternative null hypothesis value for the second effect |
s12 |
Specification of covariance between x1 and x2. Typically 0, but may be non-zero in the prescence of missing data |
Value
Boolean True/False value of whether the test rejects the Null hypothesis
Note
The function for the S-test does not incorporate interactions between the independent and mediating variables. The user must first calculate the mean and variance of the second product term to be used in the function call.
References
Berger, Roger L. Likelihood Ratio Tests and Intersection-Union Tests. Advances in Statistical Decision Theory and Applications, 2011.
Examples
sTest_one(0.05, .5, 1, 100, -.25, .1, 100)
Sobel test for the indirect effect - Single mediator path
Description
This function takes the parameter estimates and covariances and performs the Sobel test for one mediator, or a single mediator path for multiple unordered mediators.
Usage
sobelTest_one(
mu1,
sig1,
mu2,
sig2,
sig12,
indL = 1,
mu3 = 0L,
sig3 = 0L,
sig13 = 0L,
sig23 = 0L,
mu1_0 = 0,
mu2_0 = 0,
mu3_0 = 0
)
Arguments
mu1 |
Value of the estimate of the independent variable on the mediator. |
sig1 |
Value of the variance of the estimate of the independent variable on the mediator. |
mu2 |
Value of the estimate of the mediator on the response. |
sig2 |
Value of the variance of the estimate of the mediator on the response. |
sig12 |
Value of the covariance between mu1 and mu2. |
indL |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
mu3 |
Value of the estimate of the effect of the interaction of the independent and mediator variable on the response. |
sig3 |
Value of the variance of the estimate of the effect of the interaction of the independent and mediator variable on the response. |
sig13 |
Value of the covariance between mu1 and mu3. |
sig23 |
Value of the covariance between mu2 and mu3. |
mu1_0 |
Null value for mu1. |
mu2_0 |
Null value for mu2. |
mu3_0 |
Null value for mu3. |
Value
A p-value for the test for the indirect effect.
Examples
sobelTest_one(1, .1, .25, .01, .05)
Sobel test for the indirect effect - Two ordered mediator path
Description
This function takes the parameter estimates and covariances and performs the Sobel test for two ordered mediators.
Usage
sobelTest_ord(
mu1,
sig1,
mu2,
sig2,
mu3,
sig3,
mu2b = 0L,
sig2b = 0L,
mu3b = 0L,
sig3b = 0L,
sig12 = 0L,
sig12b = 0L,
sig13 = 0L,
sig13b = 0L,
sig22b = 0L,
sig23 = 0L,
sig23b = 0L,
sig2b3 = 0L,
sig2b3b = 0L,
sig33b = 0L,
indL = 1L,
mu1_0 = 0,
mu2_0 = 0,
mu3_0 = 0,
mu2b_0 = 0,
mu3b_0 = 0
)
Arguments
mu1 |
Value of the estimate of the independent variable on the first mediator. |
sig1 |
Value of the variance of the estimate of the independent variable on the first mediator. |
mu2 |
Value of the estimate of the first mediator on the second mediator. |
sig2 |
Value of the variance of the estimate of the first mediator on the second mediator. |
mu3 |
Value of the estimate of the second mediator on the response. |
sig3 |
Value of the variance of the estimate of the second mediator on the response. |
mu2b |
Value of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. |
sig2b |
Value of the variance of the estimate of the effect of the interaction of the independent and first mediator variable on the second mediator. |
mu3b |
Value of the estimate of the effect of the interaction of the independent and second mediator variable on the response. |
sig3b |
Value of the variance of the estimate of the effect of the interaction of the independent and second mediator variable on the response. |
sig12 |
Value of the covariance between mu1 and mu2. |
sig12b |
Value of the covariance between mu1 and mu2b. |
sig13 |
Value of the covariance between mu1 and mu3. |
sig13b |
Value of the covariance between mu1 and mu3b. |
sig22b |
Value of the covariance between mu2 and mu2b. |
sig23 |
Value of the covariance between mu2 and mu3. |
sig23b |
Value of the covariance between mu2 and mu2b. |
sig2b3 |
Value of the covariance between mu2b and mu3. |
sig2b3b |
Value of the covariance between mu2b and mu3b. |
sig33b |
Value of the covariance between mu3 and mu3b. |
indL |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
mu1_0 |
Null value for mu1. |
mu2_0 |
Null value for mu2. |
mu3_0 |
Null value for mu3. |
mu2b_0 |
Null value for mu2b. |
mu3b_0 |
Null value for mu3b. |
Value
A p-value for the test for the indirect effect.
Examples
sobelTest_ord(1, .1, .25, .01, 0, 0, .15, .01, 0, 0)
Sobel test for the indirect effect - Two ordered mediator path
Description
This function takes the parameter estimates and covariances and performs the Sobel test for two ordered mediators.
Usage
sobelTest_unord(
mu1,
sig1,
mu2,
sig2,
mu3,
sig3,
mu4,
sig4,
mu2b,
sig2b,
mu4b,
sig4b,
sig12 = 0L,
sig12b = 0L,
sig13 = 0L,
sig14 = 0L,
sig14b = 0L,
sig22b = 0L,
sig23 = 0L,
sig24 = 0L,
sig24b = 0L,
sig2b3 = 0L,
sig2b4 = 0L,
sig2b4b = 0L,
sig34 = 0L,
sig34b = 0L,
sig44b = 0L,
indL = 1L,
mu1_0 = 0,
mu2_0 = 0,
mu3_0 = 0,
mu4_0 = 0,
mu2b_0 = 0,
mu4b_0 = 0
)
Arguments
mu1 |
Value of the estimate of the independent variable on the first mediator. |
sig1 |
Value of the variance of the estimate of the independent variable on the first mediator. |
mu2 |
Value of the estimate of the first mediator on the response. |
sig2 |
Value of the variance of the estimate of the first mediator on the response. |
mu3 |
Value of the estimate of the independent variable on the second mediator. |
sig3 |
Value of the variance of the estimate of the independent variable on the second mediator. |
mu4 |
Value of the estimate of the second mediator on the response. |
sig4 |
Value of the variance of the estimate of the second mediator on the response. |
mu2b |
Value of the estimate of the effect of the interaction of the independent and first mediator variable on the response. |
sig2b |
Value of the variance of the estimate of the effect of the interaction of the independent and first mediator variable on the response. |
mu4b |
Value of the estimate of the effect of the interaction of the independent and second mediator variable on the response. |
sig4b |
Value of the variance of the estimate of the effect of the interaction of the independent and second mediator variable on the response. |
sig12 |
Value of the covariance between mu1 and mu2. |
sig12b |
Value of the covariance between mu1 and mu2b. |
sig13 |
Value of the covariance between mu1 and mu3. |
sig14 |
Value of the covariance between mu1 and mu4. |
sig14b |
Value of the covariance between mu1 and mu4b. |
sig22b |
Value of the covariance between mu1 and mu2b. |
sig23 |
Value of the covariance between mu2 and mu3. |
sig24 |
Value of the covariance between mu2 and mu4. |
sig24b |
Value of the covariance between mu2 and mu4b. |
sig2b3 |
Value of the covariance between mu2b and mu3. |
sig2b4 |
Value of the covariance between mu2b and mu4. |
sig2b4b |
Value of the covariance between mu2b and mu4b. |
sig34 |
Value of the covariance between mu3 and mu4. |
sig34b |
Value of the covariance between mu3 and mu4b. |
sig44b |
Value of the covariance between mu4 and mu4b. |
indL |
Value indicating the value of the independent variable used for the interaction. Typically 1. |
mu1_0 |
Null value for mu1. |
mu2_0 |
Null value for mu2. |
mu3_0 |
Null value for mu3. |
mu4_0 |
Null value for mu4. |
mu2b_0 |
Null value for mu2b. |
mu4b_0 |
Null value for mu4b. |
Value
A p-value for the test for the indirect effect.
Examples
sobelTest_unord(1, .1, .25, .01, 0, 0, .15, .01, 0, 0, 0, 0)