extractNegLogPval: Find the negative log p-value of a pair of vectors.

Description Usage Arguments Value Examples

View source: R/extractNegLogPval.R

Description

Finds the negative log p-value of a matrix, if it exists. Checks first to see if there is a p-value to return.

Usage

1
extractNegLogPval(x, y, repval = 300, lowrepval = 0, signed = F)

Arguments

x

a vector that is regressed in the fashion y~x.

y

a vector that is regressed in the fashion y~x.

repval

the replacement value if the regression cannot be performed, default 300 (the vectors are identical if this is used).

lowrepval

The low replacement value in the case that a regression p-value is undefined.

signed

change the sign of the negative log p-value based on the sign of beta? e.g. if the line has a negative slope, so will the returned value. If there is a positive slope, there will be a positive negative log p-value. if this option is disabled, then no sign changes will happen based on the sign of the slope.

Value

The negative log p-value or replacement value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#small example
xval<-c(1,1,1,1,1)
yval<-c(1,2,3,4,5)
a<-c(3,4,5,6,7)
extractNegLogPval(x=xval,y=yval) #no possible p-value if one vector is constant.
#Some edge cases this may not be correct (if the data lies near a constant),
# but the indiviual sample data should reveal true trends.
suppressWarnings(cor(xval,yval)) #you can't get a correlation value either.
cor(a,a) #gives correlation of 1.
extractNegLogPval(a,a) 
#gives replacement value.
suppressWarnings(extractNegLogPval(x=a,y=yval))
#gives 107.3909 and warns about a nearly perfect fit.

jamesdalg/CNVScope documentation built on Aug. 4, 2019, 9:24 p.m.