weightFuncs: Weighting Functions

weightFuncsR Documentation

Weighting Functions


Functions for computing SNV weights from minor allele frequences (MAF)


betaWeights(x, shape1=1, shape2=25)
logisticWeights(x, th=0.07, slope=150)



a numeric vector of minor allele frequencies (MAFs); see details below


shape parameters of Beta distribution weighting function (see dbeta for details)


parameters of the logistic weighting function (see details below)


The function betaWeights is a wrapper around the dbeta function. It uses the same parameters shape1 and shape2, but does not support the non-centrality parameter ncp. The defaults are shape1=1 and shape2=25 as suggested by Wu et al. (2011) and implemented in the SKAT package. If called without argument x, a function with a single argument x is returned that can directly be used as weighting function, e.g. passed as weightFunc argument to the assocTest method.

The function logisticWeights provides a logistic weighting that corresponds to a soft threshold function. The th parameter corresponds to the threshold and the slope parameter corresponds to the steepness of the soft threshold. Like betaWeights, this function can be called without x argument to produce a parameter-free weighting function.

The function invSdWeights computes weights as suggested by Madsen and Browning (2009). For consistency, this function also returns a single-argument function if called without x argument.

For mathematical details, see Subsection 9.3 of the package vignette.


a numeric vector with weights as long as the argument x, a function if x was missing;


Ulrich Bodenhofer bodenhofer@bioinf.jku.at



Wu, M. C., Lee, S., Cai, T., Li, Y., Boehnke, M., and Lin, X. (2011) Rare-variant association testing for sequencing data with the sequence kernel association test. Am. J. Hum. Genet. 89, 82-93. DOI: 10.1016/j.ajhg.2011.05.029.

Madsen, B. E. and Browning, S. R. (2009) A groupwise association test for rare mutations using a weighted sum statistic. PLoS Genetics 5, e1000384. 10.1371/journal.pgen.1000384

See Also

GenotypeMatrix, dbeta, assocTest


## create a toy example
A <- matrix(rbinom(50, 2, prob=0.2), 5, 10)
MAF <- colSums(A) / (2 * nrow(A))

## compute some weight vectors
betaWeights(MAF, 1, 25)
betaWeights(MAF, 1, 30)

## plot weighting functions (note the missing 'x' arguments)
plot(betaWeights(shape2=30), xlim=c(0, 1))
plot(logisticWeights(), xlim=c(0, 1))
plot(invSdWeights, xlim=c(0, 1))

UBod/podkat documentation built on Nov. 17, 2022, 6:45 p.m.