med.p.adjust: To adjust the p values for multimediation tests

Description Usage Arguments Value References Examples

View source: R/MedSurvey.R

Description

This function is used to adjust the p values when there are multiple mediators (Mai et al., 2019).

Usage

1
2
3
4
5
med.p.adjust(
  fit = NULL,
  med.eff = NULL,
  p.adj.method = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr")
)

Arguments

fit

The model fit results of a model with multiple mediators. Note that it is a lavaan object.

med.eff

A vector of labels. The labels should be of the mediation effects in the estimated model.

p.adj.method

The method used to adjust for multiplicity ('holm' or 'hochberg' or 'hommel' or 'bonferroni' or 'BH' or 'BY' or 'fdr'). Conservative method includes the Bonferroni correction ('bonferroni') in which the p-values are multiplied by the number of comparisons. Less conservative corrections are also included by Holm (1979) ('holm'), Hochberg (1988) ('hochberg'), Hommel (1988) ('hommel'), Benjamini & Hochberg (1995) ('BH' or its alias 'fdr'), and Benjamini & Yekutieli (2001) ('BY'), respectively. It is 'holm' by default. It is not required.

Value

The adjusted p values along with the effect labels and original p values. It is a list.

References

Benjamini, Y., & Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society Series B, 57, 289–300. DOI:10.2307/2346101

Benjamini, Y., & Yekutieli, D. (2001). The control of the false discovery rate in multiple testing under dependency. Annals of Statistics, 29, 1165–1188. DOI:10.1214/aos/1013699998

Holm, S. (1979). A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics, 6, 65–70.

Hommel, G. (1988). A stagewise rejective multiple test procedure based on a modified Bonferroni test. Biometrika, 75, 383–386. DOI:10.1093/biomet/75.2.383

Hochberg, Y. (1988). A sharper Bonferroni procedure for multiple tests of significance. Biometrika, 75, 800–803. DOI:10.1093/biomet/75.4.800

Rosseel, Y. (2012). Lavaan: An R package for structural equation modeling and more. Version 0.5–12 (BETA). Journal of statistical software, 48(2), 1-36. DOI:10.18637/jss.v048.i02

Shaffer, J. P. (1995). Multiple hypothesis testing. Annual Review of Psychology, 46, 561–576.

Sarkar, S. (1998). Some probability inequalities for ordered MTP2 random variables: a proof of Simes conjecture. Annals of Statistics, 26, 494–504. DOI:10.1214/aos/1028144846

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
R <- 160
wgtnames <- paste("repwgt", seq(0,R,by=1), sep="")
mwgtname=wgtnames[1]
repwgtnames=wgtnames[2:(R+1)]
fayfactor=0.5

model2 <- ' # outcome
              numcg ~ u0*1 + c*workban + b1*sp_adltban + b2*sp_kidsban
            # mediator
              sp_adltban ~ u1*1 + a1*workban
              sp_kidsban ~ u2*1 + a2*workban
            #covariance of residuals
              sp_adltban ~~ sp_kidsban
            # indirect effect (a*b)
              a1b1 := a1*b1
              a2b2 := a2*b2
            # total effect
              total := c + (a1*b1) + (a2*b2)
           '
fit.BRR2 <- med.fit.BRR(model=model2, data=MedData, mwgtname=mwgtname,
             repwgtnames=repwgtnames, fayfactor, parallel='parallel', ncore=4)
temp <- med.p.adjust(fit=fit.BRR2, med.eff=c('a1b1' , 'a2b2'))
#
# Adjustment for multi mediation tests:
#
#      Effect          p Value      adj.p Value
#       a1b1      0.003667674      0.007335347
#       a2b2      0.217228711      0.217228711
#
# NOTE: 	 p Value adjustment method is holm
#
#########################################
# To catch the unformatted results:
temp
#
# $med.eff
# [1] "a1b1" "a2b2"
#
# $org.p.value
# [1] 0.003667674 0.217228711
#
# $adj.p.value
# [1] 0.007335347 0.217228711

MedSurvey documentation built on Oct. 23, 2020, 7:15 p.m.