autocorrP {MasterBayes}R Documentation

Autocorrelation Function for Parenatge Assignment

Description

Function for assesing mixing of the Markov chain with respect to parentage assignment.

Usage

autocorrP(postP, ...)

Arguments

postP JOINT posterior distribution of parentage
... further arguments to be passed

Details

For each offspring the proportion of transitions is calculated at lags 1, 2, 5, 10, 50 and 100 (i.e. the proportion of times that the parentage assignment at time t is different from the parentage assignement at time t+lag). The difference between these proportions and the proportion at lag 1 is then calculated, and the mean over offspring given. Samples are independent when this difference is non-decreasing with increasing lag. When the parentage assignemnets in each MCMC iteration are independent these autocorrelation metrics should be randomly distributed about zero.

Value

matrix

Author(s)

Jarrod Hadfield j.hadfield@ed.ac.uk

See Also

MCMCped

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=3000, thin=1,  burnin=0, write_postP="JOINT") 

autocorrP(model1$P)


[Package MasterBayes version 2.42 Index]