Rsq.measure: Function to calculate the Rsq function as a total mediation...

View source: R/RsqMed.R

Rsq.measureR Documentation

Function to calculate the Rsq function as a total mediation effect size measure (Gaussian outcome only). If method = 'iSIS', a two-step procedure is performed, where the first step filters the non-mediators based on the first p proportion of the data and the second step calculates the point estimates for Rsq using random-effect models on the remaining data. If method = 'ALL', Rsq is calculated based on all subjects and mediators (assuming all mediators are the true mediators). It is optional to adding filtering step on putative mediators to exclude M1 type of non-mediators (See Yang et al, BMC bioinformatics, 2021).

Description

Function to calculate the Rsq function as a total mediation effect size measure (Gaussian outcome only). If method = 'iSIS', a two-step procedure is performed, where the first step filters the non-mediators based on the first p proportion of the data and the second step calculates the point estimates for Rsq using random-effect models on the remaining data. If method = 'ALL', Rsq is calculated based on all subjects and mediators (assuming all mediators are the true mediators). It is optional to adding filtering step on putative mediators to exclude M1 type of non-mediators (See Yang et al, BMC bioinformatics, 2021).

Usage

Rsq.measure(
  p = 1/2,
  Y,
  M,
  Covar = NULL,
  X,
  method = c("iSIS", "ALL"),
  iter.max = 3,
  nsis = NULL,
  init.FDR.cutoff = 0.1,
  filtering = FALSE
)

Arguments

p

Proportion of the training dataset for selecting mediators regarding the whole dataset, default is set as 1/2. If method = 'ALL', all subjects are included.

Y

Vector of outcome; Only Gaussian distributed outcome is accepted.

M

Matrix of putative mediators

Covar

Covariate matrix or vector, default = NULL

X

Vector of the independent variable of interest, e.g. environmental variable

method

Method used to screen out M2 type of non-mediators. When method = 'ALL', no variable selection is performed and Rsq is calculated on all data; otherwise, iterative sure independence screening (SIS) is performed on training dataset, i.e., method = 'iSIS'.

iter.max

Maximum number of iteration used in iSIS, default = 3

nsis

Number of variables recruited by iterative SIS (please refer the SIS package for detailed explanations)

init.FDR.cutoff

FDR threshold for the filtering after SIS.

filtering

When filtering = TRUE, filtering based on the strength of independent variable and mediators after SIS is performed; When filtering = FALSE, no preprocessing is performed before variable selection. By default filtering = FALSE.

Value

Output Vector consists of Rsq mediated(Rsq.mediated), shared over simple effects (SOS), number of selected mediators (pab), and the Rsq that used to calculate the Rsq measure: variance of outcome explained by mediator (Rsq.YM), variance of outcome explained by the independent variable (Rsq.YX), and variance of outcome explained by mediator and independent variable (Rsq.YMX), n.train is the sample size on which variable selection is performed, n.estimate is the sample size based on which the mediation effect is estimated.

Name of selected putative mediators (select). Note that M1 type of non-mediators may still be included in the model, but it would not impact the estimation of total mediation effect under certain assumptions.

Examples

{
## Not run: 
data(example)
attach(example)
Rsq.measure(p=1/2, Y=Y, M=M,Covar=Cov,X=X,method='iSIS', iter.max=1, filtering=TRUE)

## End(Not run)
}

RsqMed documentation built on Nov. 15, 2023, 1:07 a.m.

Related to Rsq.measure in RsqMed...