calcExactBayesFactorServinStephens: Exact Bayes factor

View source: R/quantgen.R

calcExactBayesFactorServinStephensR Documentation

Exact Bayes factor

Description

Calculate the exact Bayes factor proposed by Servin and Stephens in PLoS Genetics 3,7 (2007, http://dx.doi.org/10.1371/journal.pgen.0030114).

Usage

calcExactBayesFactorServinStephens(G, Y, sigma.a, sigma.d, log10 = TRUE)

Arguments

G

vector of genotypes

Y

vector of phenotypes

sigma.a

variance of the prior on the additive genetic effect

sigma.d

variance of the prior on the dominance genetic effect

log10

return the log10 of the ABF

Value

numeric

Author(s)

Bertrand Servin [aut], Timothee Flutre [ctb,cre]

Examples

## Not run: ## make fake data
set.seed(1859)
n <- 200
mu <- 50
maf <- 0.3
genos <- sample(x=c(0,1,2), size=n, replace=TRUE, prob=maf2genoFreq(maf))
(beta <- pve2beta(pve=0.4, n=n, maf=maf, sigma=1))
phenos <- mu + beta * genos + rnorm(n=n, mean=0, sd=1)

boxplot(phenos ~ genos, las=1, xlab="genotypes", ylab="phenotypes", at=0:2)

## perform inference via maximum likelihood
(fit <- lm(phenos ~ genos))
abline(fit)

## compute the Bayes factors
(BF <- calcExactBayesFactorServinStephens(G=genos, Y=phenos, sigma.a=0.5,
                                          sigma.d=NULL))
(aBF <- calcAsymptoticBayesFactorWakefield(theta.hat=coef(fit)[2],
                                           V=diag(vcov(fit))["genos"],
                                           W=0.5^2))

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.