Estimating inbreeding coefficients

with WinBUGS

The following is the WinBUGS code necessary to estimate the inbreeding coefficient within a population at a locus with four alleles and partial dominance. The data is the SMFO data from the 26 January lecture.

# the model
model SMFOf;
{
    # The priors
	s1 ~ dgamma(1,0.01);
	m1 ~ dgamma(1,0.01);
	f1 ~ dgamma(1,0.01);
	o1 ~ dgamma(1,0.01);
	F ~ dunif(-1,1);
	s <- s1/(s1 + m1 + f1 +o1);
	m <- m1/(s1 + m1 + f1 +o1);
	f <- f1/(s1 + m1 + f1 +o1);
	o <- o1/(s1 + m1 + f1 +o1);
	
	# Allele frequencies into genotype frequenices
	pi[1] <- (s*s + 2*s*o)*(1-F) + s*F;
	pi[2] <- (m*m + 2*m*o)*(1-F) + m*F;
	pi[3] <- (f*f + 2*f*o)*(1-F) + f*F;
	pi[4] <- (o*o)*(1-F) + o*F;
	pi[5] <- (2*s*m)*(1-F);
	pi[6] <- (2*m*f)*(1-F);
	pi[7] <- (2*s*f)*(1-F);
	
	# The sample
	x[1:7] ~ dmulti(pi[],n);
}

# the data
list(n= 1786, x = c(1149, 36, 17, 20, 336, 25, 203))

# the inits
list(F = 0.0)

You can also download the code by right clicking here.


webmaster@darwin.eeb.uconn.edu
Last modified: Fri Jan 19 09:33:17 EST 2001