Bug 14646

Summary: confint.mle fault with fixed parameters of the likelihood function
Product: R Reporter: Jinsong Zhao <jszhao>
Component: S4methodsAssignee: R-core <R-core>
Status: CLOSED FIXED    
Severity: enhancement    
Priority: P5    
Version: R 2.13.1   
Hardware: ix86 (32-bit)   
OS: Windows 32-bit   

Description Jinsong Zhao 2011-08-04 08:34:28 UTC
Hi there,

confint.mle will trigger a error message when some parameters of the likelihood function were fixed:

Error in approx(sp$y, sp$x, xout = cutoff) : 
  need at least two non-NA values to interpolate

I searched the mailing list archive, and find that: About one year ago, Arnaud Le Rouzic <lerouzic_at_legs.cnrs-gif.fr> post a same question to R-help mailing list (http://tolstoy.newcastle.edu.au/R/e11/help/10/07/3271.html, Problem #1) The mini-example in the post is quoted here:


minusLogL1 <- function(mu, logsigma2) { N*log(2*pi*exp(logsigma2))/2 + N*(var(x)+(mean(x)-mu)^2)/(2*exp(logsigma2)) } 

minusLogL2 <- function(mu) { logsigma2 <- 0; N*log(2*pi*exp(logsigma2))/2 + N*(var(x)+(mean(x)-mu)^2)/(2*exp(logsigma2)) }

N <- 100
x <- rnorm(N, 0, 1)

fit <- mle(minusLogL1, start=list(mu=0, logsigma2=0)) 

fit2 <- mle(minusLogL1, start=list(mu=0), fixed=list(logsigma2=0))

fit3 <- mle(minusLogL2, start=list(mu=0)) 

And about seven years ago,  Ben Bolker (bolker@zoo.ufl.edu) post a message to R-devel (http://tolstoy.newcastle.edu.au/R/devel/04a/1283.html). In that post, he suggested:

call$fixed <- fix
call$fixed <- c(fix,eval(call$fixed))
for cases where there are non-trivial fixed arguments 

After tested in R2.13.1, the above error disappeared. Thus, it may be the correct way to deal with this situation. However, why the patch was not accepted for seven years. Bug or feature?

Comment 1 Brian Ripley 2011-08-08 16:38:49 UTC
Fixed in 2.13.1 patched (with a better patch)