Post date: Feb 23, 2014 9:9:23 PM
If it's a p-box in pbox.r, you can use the function
ci <- function(b, c=0.95, p1=(1-c)/2, p2=1-(1-c)/2) interval(left(cut(b,p1)), right(cut(b,p2)))
In RIsk Calc, it would be something like
function ci() { b =$1; if (args<2) p1=0.025 else p1 = $2; if (args<3) p2=1-p1 else p2 = $3; return [left(cut(b,p1)), right(cut(b,p2))] }
If you're using the software from the c-box website, it would be
ci <- function(b, c=0.95, alpha=(1-c)/2, beta=1-(1-c)/2) {
left = sort(b[1:many])[round(alpha*many)]
if (many < length(b)) right = sort(b[(many+1):length(b)])[round(beta*many)] else
right = sort(b[1:many])[round(beta*many)]
c(left,right)
}
Scott