1bradley.terry.post=function(theta,data)
2{
3N=dim(data)[1]; M=length(theta)
4sigma=exp(theta[M])
5logf=function(k)
6{
7i=data[k,1]; j=data[k,2]
8p=exp(theta[i]-theta[j])/(1+exp(theta[i]-theta[j]))
9data[k,3]*log(p)+data[k,4]*log(1-p)
10}
11sum(sapply(1:N,logf))+sum(dnorm(theta[-M],0,sigma,log=TRUE))
12}
13