model 
{
   q ~ dunif(0,1)                            # prevalence of a1
   p <- 1 - q                                   # prevalence of a2
   Ann1   ~ dbin(q,2);   Ann <- Ann1 + 1      # geno. dist. for founder
   Brian1 ~ dbin(q,2);   Brian <- Brian1 + 1 
   Clare  ~ dcat(p.mendelian[Ann,Brian,])    # geno. dist. for child
   Diane  ~ dcat(p.mendelian[Ann,Brian,]) 
   Eric1  ~ dbin(q,2)
   Eric <- Eric1 + 1 
   Fred   ~ dcat(p.mendelian[Diane,Eric,]) 
   Gene   ~ dcat(p.mendelian[Diane,Eric,]) 
   Henry1 ~ dbin(q,2)
   Henry <- Henry1 + 1 
   Ian    ~ dcat(p.mendelian[Clare,Fred,]) 
   Jane   ~ dcat(p.mendelian[Gene,Henry,]) 
   A1 ~ dcat(p.recessive[Ann,])               # phenotype distribution
   B1 ~ dcat(p.recessive[Brian,]) 
   C1 ~ dcat(p.recessive[Clare,]) 
   D1 ~ dcat(p.recessive[Diane,]) 
   E1 ~ dcat(p.recessive[Eric,]) 
   F1 ~ dcat(p.recessive[Fred,]) 
   G1 ~ dcat(p.recessive[Gene,]) 
   H1 ~ dcat(p.recessive[Henry,]) 
   I1 ~ dcat(p.recessive[Ian,]) 
   J1 ~ dcat(p.recessive[Jane,])  
   a <- equals(Ann, 2)                        # event that Ann is carrier
   b <- equals(Brian, 2) 
   c <- equals(Clare, 2) 
   d <- equals(Diane, 2) 
   e <- equals(Eric, 2) ;
   f <- equals(Fred, 2) 
   g <- equals(Gene, 2) 
   h <- equals(Henry, 2) 
   for (J in 1:3) {
          i[J] <- equals(Ian, J)       # i[1] = a1 a1
                                                  # i[2] = a1 a2
                                                  # i[3] = a2 a2 (i.e. Ian affected)
   }                     

}
