1histprior=function(p,midpts,prob)
2{
3binwidth=midpts[2]-midpts[1]
4lo=round(10000*(midpts-binwidth/2))/10000
5val=0*p
6for (i in 1:length(p))
7{
8 val[i]=prob[sum(p[i]>=lo)]
9}
10return(val)
11}