knitr::opts_chunk$set(echo = TRUE)
## Load packages
library(devtools)
library(dplyr)
library(ggplot2)
library(cowplot)
library(latex2exp)

library(coda)
library(Rcpp)

library(moiR)
load_all('.')

Test Fitness functions

testFITNESS()

Example of fitness calculation and update of only one SNP

X<-matrix(ncol=100,nrow=100,sample(c(-1,1), 100*100,replace=T))
X[1,]<- -1
X[1,1]<- 1
message("selection coefficients uniform" )
s = exp(rnorm(100,0,0.1)) - 1
w1<-Wgo(X,s,1)
s2<-s
s2[1]<-10
w2<-Wgo(X,s,s2,1,w1)
w3=Wgo(X,s2,1)

plot(s,s2)
plot(w1,w2)
plot(w2,w3)

Test proposals of hyperparameters

Here all get updated at each iteration, in the MCMC one at a time

test_GPROPOSALR()

Test proposals of selection coefficients

message("Uniform distribution")
test_SPROPOSALR(1)

message("lognormal distribution")
test_SPROPOSALR(3)

Test prior

y=test_PRIORR()

qplot(y, xlab='likelihood')


MoisesExpositoAlonso/popgensim documentation built on May 7, 2019, 8:57 p.m.