getp.func: This function caculate P-value for every trio

View source: R/getp.R

getp.funcR Documentation

This function caculate P-value for every trio

Description

This function calculates the P-value for each trios. If Minperm=0, only the nominal P-value is calculated. If Minperm=Maxperm, the empirical P-value is calculated using a fixed number of permutation statistics; otherwise, the empirical P-value is calculated using the adaptive permutation scheme. The user can specify whether to use the GPD fit to estimate a more accurate empirical P-value, and at the same time specify how small the empirical P-value is for GPD fitting.

Usage

getp.func(
  i,
  triomatrix,
  confounders,
  Minperm = 100,
  Maxperm = 10000,
  use.gpd = FALSE,
  gpd.perm = 0.01,
  pool_cov = NULL,
  est_conf_pool_idx = NULL,
  use.PC = FALSE
)

Arguments

i

Trios index in triomatrix

triomatrix

A three-dimensional matrix of size: samples number * trios number * 3. Triomatrix[i,j,1] represents the genotype of the j-th trios at the i-th sample,and triomatrix[i,j,2] represents the feature1 data of the j-th trios at the i-th sample, triomatrix[i,j,3] represents the feature2 data of the j-th trios at the i-th sample.

Minperm

Decide whether to use the parameters of the GPD fit. If the value is 0, only the nominal P-value is calculated. If the proportion of the permutation statistic better than the original statistic to the total number of permutations exceeds this value, a more accurate empirical P value is estimated using the GPD fit. If Minperm=0, only the nominal P-value is calculated. We set Minperm=100 as default.

Maxperm

Maximum number of permutation. We set Maxperm=10000 as default.

use.gpd

Whether to use the GPD fit to estimate a more accurate empirical P-value. We set use.gpd=NULL as default.

gpd.perm

The proportion parameter for estimating the empirical P-value when using GPD fit. When the proportion of permutation better than the original statistic is greater than par, the GPD is fitted to estimate the empirical P-value. We set gpd.perm=0.01 as default.

pool_cov

Candidate Confusion Variable Pool. We set pool_cov=NULL as default, which use.PC requied.

est_conf_pool_idx

The index of the adaptively selected confunding variable. We set pool_cov=NULL as default, at this time pool_cov=NULL too.

use.PC

Whether the candidate confusion variable pool is PCs.

confunders

A confounders matrix which is adjusted in all mediation tests.

Value

The algorithm will return a list of nperm, empirical.p, empirical.p.gpd, nominal.p, std.error, t_stat, beta, beta.total, beta.change.

nperm

The actual number of permutations for testing mediation, equal to the input parameter nperm.

empirical.p

The mediation Empirical P-values with nperm times permutation.

empirical.p.gpd

The mediation Empirical P-values with nperm times permutation using GPD fit.

nominal.p

The mediation nominal P-values. A matrix with dimension of the number of trios.

std.error

The return std.error value of feature1 for fit liner models.

t_stat

The return t_stat value of feature1 for fit liner models.

beta

The return beta value of feature2 for fit liner models in the case of feature1.

beta.total

The return beta value of feature2 for fit liner models without considering feature1.

beta.change

The proportions mediated.


QidiPeng/eQTLMAPT documentation built on Jan. 25, 2023, 11:03 p.m.