R: Markov chain Monte Carlo Methods for Pedigree Reconstruction...
MCMCped
R Documentation
Markov chain Monte Carlo Methods for Pedigree Reconstruction and Analysis
Description
Markov chain Monte Carlo methods for estimating the joint posterior distribution of a pedigree and the parameters that predict its structure using genetic and non-genetic data. These parameters can be associated with covariates of fecundity such as a sexually selected trait or age, or can be associated with spatial or heritable traits that relate parents to specific offspring. Population size, allele frequencies, allelic dropout rates, and stochastic genotyping error rates can also be simultaneously estimated.
if TRUE the marignal posterior distribution of true genotypes is stored
write_postA
if TRUE the joint posterior distribution of allele frequencies is stored
write_postP
if "MARGINAL" the marginal distribution of parents is stored. If "JOINT" the joint distribution of parents (the pedigree) is stored.
checkP
if TRUE the pedigree is checked for legality, and illegal pedigrees rejected. If FALSE it is assumed that any potential parent would produce a legal pedigree, i.e one without circuits, in the terminology of graph theory.
jointP
if TRUE both parents are sampled simultaneously, if FALSE each parent is sampled conditional on the other. TRUE should mix faster, but FALSE should iterate faster, especially when relational="MATE" is passed to varPed
DSapprox
if TRUE the likelihood for models in which a relational="MATE" variable is passed is approximated. This can be much more efficient because the denominator of the multinomial is the summed linear pedictors for combinations in which i=m or j=m where m referes to the "MATE" at the current iteration.
verbose
if TRUE posterior samples and the Metropolis Hastings accpetance rates of beta, USdam, USsire, E1, E2 are printed to the screen every 1000 iterations.
Value
beta
an mcmc object containing samples from the posterior distribution of the population level parameters
USdam
an mcmc object containing samples from the posterior distribution of the number of unsampled females
USsire
an mcmc object containing samples from the posterior distribution of the number of unsampled males
E1
an mcmc object containing samples from the posterior distribution of allelic dropout rates for codominant markers or the probability of mis-scoring a dominant allele as recessive for dominant markers
E2
an mcmc object containing samples from the posterior distribution of stochasting genotyping error rates for codominant markers or the probability of mis-scoring a recessive allele as dominant for dominant markers
G
list of marginal distributions of true genotypes at each locus
A
list of mcmc objects containing samples from the posterior distribution of the base population allele frequencies at each locus
P
either samples from the posterior distribution of the pedigree, or the marginal distribution of parents
Hadfield J.D. et al (2006) Molecular Ecology 15 3715-31
See Also
getXlist
Examples
data(WarblerP)
data(WarblerG)
GdP<-GdataPed(WarblerG)
var1<-expression(varPed(c("lat", "long"), gender="Male",
relational="OFFSPRING"))
# paternity is to be modelled as a function of distance
# between offspring and male territories
res1<-expression(varPed("offspring", restrict=0))
# indivdiuals from the offspring generation are excluded as parents
res2<-expression(varPed("terr", gender="Female", relational="OFFSPRING",
restrict="=="))
# mothers not from the offspring territory are excluded
PdP<-PdataPed(formula=list(var1,res1,res2), data=WarblerP, USsire=FALSE)
tP<-tunePed(beta=30)
model1<-MCMCped(PdP=PdP, GdP=GdP, tP=tP, nitt=300, thin=1, burnin=0)
plot(model1$beta)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MasterBayes)
Loading required package: coda
Loading required package: genetics
Loading required package: combinat
Attaching package: 'combinat'
The following object is masked from 'package:utils':
combn
Loading required package: gdata
gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.
Attaching package: 'gdata'
The following object is masked from 'package:stats':
nobs
The following object is masked from 'package:utils':
object.size
The following object is masked from 'package:base':
startsWith
Loading required package: gtools
Loading required package: MASS
Loading required package: mvtnorm
NOTE: THIS PACKAGE IS NOW OBSOLETE.
The R-Genetics project has developed an set of enhanced genetics
packages to replace 'genetics'. Please visit the project homepage
at http://rgenetics.org for informtion.
Attaching package: 'genetics'
The following objects are masked from 'package:base':
%in%, as.factor, order
Loading required package: kinship2
Loading required package: Matrix
Loading required package: quadprog
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MasterBayes/MCMCped.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MCMCped
> ### Title: Markov chain Monte Carlo Methods for Pedigree Reconstruction and
> ### Analysis
> ### Aliases: MCMCped
> ### Keywords: models
>
> ### ** Examples
>
>
> data(WarblerP)
> data(WarblerG)
>
> GdP<-GdataPed(WarblerG)
>
> var1<-expression(varPed(c("lat", "long"), gender="Male",
+ relational="OFFSPRING"))
>
> # paternity is to be modelled as a function of distance
> # between offspring and male territories
>
> res1<-expression(varPed("offspring", restrict=0))
>
> # indivdiuals from the offspring generation are excluded as parents
>
> res2<-expression(varPed("terr", gender="Female", relational="OFFSPRING",
+ restrict="=="))
>
> # mothers not from the offspring territory are excluded
>
> PdP<-PdataPed(formula=list(var1,res1,res2), data=WarblerP, USsire=FALSE)
> tP<-tunePed(beta=30)
>
> model1<-MCMCped(PdP=PdP, GdP=GdP, tP=tP, nitt=300, thin=1, burnin=0)
Starting parameterisation
beta =
-0.04818
E1 =
0.00500
E2 =
0.00500
>
> plot(model1$beta)
>
>
>
>
>
>
> dev.off()
null device
1
>