Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I've been under the impression that the mid-$p$ values generally control the Type I error, and consequently confidence intervals based on mid-$p$ values control the coverage. However I have checked that this is not true with the binom.midp() function of the binomSamSize package (see below).

Is it a problem with binom.midp()?

library(binomSamSize)

coverage <- function(p, n, conf){
    bounds <- binom.midp(0:n,n,conf)
    low <- bounds$lower
    up <- bounds$upper
    covered <- which(low<p & p <up)-1
    sum(dbinom(covered, n, p)) 
}

n <- 100
conf <- 95/100
p <- seq(0.01,0.99,length.out=100) 

cover <- sapply(p, function(p){
    coverage(p,n,conf)
    }
)

plot(p,cover,type="l")
abline(h=conf, lty=2)

coverage

EDIT: Now I have checked the significance level of the hypothesis test based on the mid-p value (very easy to implement), and the results are in agreement:

### mid-p value for H0:{p>p0} 
pv <- function(x,n,p0){
    pbinom(x, n, p0)-dbinom(x,n,p0)/2 
}
### typeI error
typeI <- function(p,n,alpha){
    pvs <- pv(0:n,n,p)
    rejected <- which(pvs<alpha)-1
sum(dbinom(rejected,n,p))
}

### test 
n <- 100
alpha <- 5/100
p <- seq(0.01,0.99,length.out=100) 

probs <- sapply(p, function(p){
    typeI(p,n,alpha)
    }
)

plot(p,probs,type="l")
abline(h=alpha,lty=2)

significance

share|improve this question
1  
Hi Stephane. You might want to look at L. D. Brown, T. Cai, and A. DasGupta (2001), Interval estimation for a binomial proportion, Statistical Science, vol. 16, no. 2, 101-133. There, they point out a connection between the Clopper-Pearson (guaranteed coverage), mid-P, and Jeffreys (no guaranteed coverage, especially near end) intervals. See Section 3.2 and Section 4.3. I have not gone through all the details, but I believe the effect you are seeing is real. – cardinal Apr 8 '12 at 20:18
Thanks cardinal. You posted your comment and I posted my edit at the same time. Nevertheless I remain sure than mid-p values control the Type I for certain models. But not the binomial one, as we saw. – Stéphane Laurent Apr 9 '12 at 6:42
... but I would not be surprised that the binomial mid-p value unconditionally achieve a good Type I error in the context of this question stats.stackexchange.com/questions/25972/… – Stéphane Laurent Apr 9 '12 at 6:44

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.