Hi,
I want to calculate, for any likelihood function, the value(s) of the
parameter of interest that makes the likelihood equal to 1/8-th of the
value of the likelihood at the maximum. Say, with the following toy
example with a binomial distribution and with interest in p:

p<-seq(0.01,0.99,by=0.001)
n=113
y=28
llbin<-y*log(p)+(n-y)*log(1-p) #log-likelihood
lbin<-exp(llbin) #likelihood
rlbin<-mat.or.vec(length(p),nc=1) #relative-likelihood
for (i in 1:length(p)) {
  rlbin[i]<-lbin[i]/max(lbin)
  }

How do I obtain the value of p such that rlbin=0.125?
It doesn't seem to me that I can do this using solve.
I can do this

rlbinp<-cbind(rlbin,p)
rlbinp

and actually look at the two values of p that make the rlbin go down to
0.125*max(rlbin), but there must be another way.
The corresponding function in Octave (and Matlab) is fzero.
Thanks in advance,
Rubén

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to