calcExactBayesFactorServinStephens | R Documentation |
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).
calcExactBayesFactorServinStephens(G, Y, sigma.a, sigma.d, log10 = TRUE)
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 |
numeric
Bertrand Servin [aut], Timothee Flutre [ctb,cre]
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.