Saddle_Prob: Calculate Saddlepoint p values (for external libraries)

Description Usage Arguments Value See Also Examples

View source: R/SPA_functions.R

Description

Function to calculate the SPA p value from score function. Intended to be used by external libraries.

Usage

1
2
3
Saddle_Prob(q, mu, g, Cutoff=2,alpha,output="P",nodes.fixed,nodes.init,log.p=FALSE)
Saddle_Prob_fast(q, g,mu,gNA,gNB,muNA,muNB,Cutoff=2,alpha,output,nodes.fixed,
nodes.init,log.p=FALSE)

Arguments

q

Numeric scalar, score statistic.

mu

Numeric vector, fitted probabilities from the null model.

g

Numeric vector, covariate adjusted genotypes.

gNA

Numeric vector, covariate adjusted genotypes where the observed genotype is zero.

gNB

Numeric vector, covariate adjusted genotypes where the observed genotype is non-zero.

muNA

Numeric vector, fitted probabilities from the null model where the observed genotype is zero.

muNB

Numeric vector, fitted probabilities from the null model where the observed genotype is non-zero.

Cutoff

An integer or the string "BE" denoting the standard deviation cutoff to be used. If Cutoff = "BE", the level-specific cutoff based on Berry-Esseen theorem is calculated. If the test statistic lies within the standard deviation cutoff of the mean, p-value based on traditional score test is returned. Default value is 2.

alpha

Significance level for the test(s), default value is 5\times 10^{-8}. Used only if Cutoff = "BE".

output

String specifying the output required. Possible values are "P" (default), "metaZ", "metaGC", and "metaspline".

nodes.fixed

Vector denoting the spline nodes for the spline based summary statistics, if you do not want to provide a fixed set of nodes instead of estimating the optimal set of nodes. Only applicable when the output is "metaspline".

nodes.init

Vector denoting the initial values of the spline nodes when you want to estimate the optimal set of spline nodes using the coordinate descent algorithm. Only applicable when the output is "metaspline". Ignored if nodes.fixed is provided. The node at 0 will be automatically added, no need to provide that. The number of finally selected nodes will be the same as in nodes.init.

log.p

Whether to return natural log-transformed p-values, default value is FALSE.

Value

p.value

p-value or natural log-transformed p-value based on the saddlepoint approximation. If output = "P", it is unsigned. For all other choice of output, it is signed.

p.value.NA

p-value or natural log-transformed p-value based on the normal approximation (traditional score test). If output = "P", it is unsigned. For all other choice of output, it is signed.

Is.converge

"TRUE" or "FALSE" denoting whether the root-finding algorithm for the saddlepoint equation has converged.

Score

Centered score statistic.

splfun

Outputs from fitting the CGF-Spline method, if output = "metaspline".

var

Variance of the score test statistic, if output = "metaspline".

See Also

ScoreTest_SPA

ScoreTest_SPA_wMeta

Examples

1
2
3
4
5
## Not run: 
Saddle_Prob(q, mu, g, Cutoff=2,alpha,output="P",nodes.fixed,nodes.init,log.p=FALSE)
Saddle_Prob_fast(q, g,mu,gNA,gNB,muNA,muNB,Cutoff=2,alpha,output,nodes.fixed,nodes.init,log.p=FALSE)

## End(Not run)

SPAtest documentation built on Sept. 4, 2020, 5:07 p.m.

Related to Saddle_Prob in SPAtest...