R/bradley.terry.post.R

Defines functions bradley.terry.post

Documented in bradley.terry.post

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

Try the LearnBayes package in your browser

Any scripts or data that you put into this service are public.

LearnBayes documentation built on March 19, 2018, 1:04 a.m.