Description Usage Arguments Examples
View source: R/GppDxy.UncertainModel.R
This function returns a vector of dxy values simulated from a posterior distribution
1 2 | GppDxy.UncertainModel(posterior.samples, loci.per.step, sample.vec.0,
sample.vec.1, sequence.length.vec)
|
posterior.samples |
List of posterior samples with columns for single column for each parameter and a row for each step of the MCMC chain [see read.posterior] |
loci.per.step |
Number of genealogies to simulate for each joint parameter combination of the posterior MCMC chain |
sample.vec.0 |
List of number of sampled individuals for population 0 for each locus in the empirical distribution |
sample.vec.1 |
List of number of sampled individuals for population 1 for each locus in the empirical distribution |
sequence.length.vec |
List of the locus length for each locus in the empirical dataset; can be set to c(190,190) to simulate all loci with length of 190 nucleotides |
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
library(GppFst)
library(phybase)
east.samples <- read.csv('~/Desktop/GppFST_Tutorial/eastsamples.txt') # csv file: each row is a locus, column = # number of samples for population 0
west.samples <- read.csv('~/Desktop/GppFST_Tutorial/westsamples.txt') # csv file: each row is a locus, column = # number of samples for population 1
MCMC.samples <- read.posterior(posterior.file = '~/Desktop/GppFST_Tutorial/atrox_snap_gamma.log', format = "tab", burnin = .25) # Read in posterior file (east = pop0, west = pop1)
PPS.results <- GppDxy.UncertainModel(posterior.samples = MCMC.samples, loci.per.step = 1, sample.vec.0 = east.samples[,1], sample.vec.1 = west.samples[,1], sequence.length.vec = c(190,190))
mean(as.numeric(PPS.results) # get mean
hist(as.numeric(PPS.results) # plot distribution
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.