[R] [FORGED] Question on Binom.Confint
Spencer Graves
@pencer@gr@ve@ @end|ng |rom e||ect|vede|en@e@org
Fri Sep 14 18:34:04 CEST 2018
On 2018-09-14 08:52, Guo, Fang (Associate) wrote:
> It's method="lrt" and I used the "binom" package.
The ultimate answer can be obtained as follows:
> debug(binom.confint)
> binom.confint(x = 0, n = 100, tol = 1e-8, method='lrt')
Then walk through the code line by line.
Reading the code, I find the following:
if (any(method == "lrt") || all.methods) {
res.lrt <- binom.lrt(x, n, conf.level = conf.level, ...)
res <- if (is.null(res))
res.lrt
else rbind(res, res.lrt)
}
Then check the help page for "binom.lrt". That includes the
following:
Confidence intervals are based on profiling the binomial deviance in the
neighbourhood of the MLE. If x == 0 or x == n and bayes is TRUE, then a
Bayesian adjustment is made to move the log-likelihood function away
from Inf. Specifically, these values are replaced by (x + 0.5)/(n + 1),
which is the posterier mode of f(p|x) using Jeffrey's prior on p.
Furthermore, if conf.adj is TRUE, then the upper (or lower) bound uses a
1 - alpha confidence level. Typically, the observed mean will not be
inside the estimated confidence interval. If bayes is FALSE, then the
Clopper-Pearson exact method is used on the endpoints. This tends to
make confidence intervals at the end too conservative, though the
observed mean is guaranteed to be within the estimated confidence limits.
Spencer
>
> -----Original Message-----
> From: Rolf Turner [mailto:r.turner using auckland.ac.nz]
> Sent: Thursday, September 13, 2018 10:02 PM
> To: Guo, Fang (Associate) <FAGuo using cornerstone.com>
> Cc: r-help using R-project.org
> Subject: Re: [FORGED] [R] Question on Binom.Confint
>
>
> On 09/14/2018 08:15 AM, Guo, Fang (Associate) wrote:
>
>> Hi,
>>
>> I have a question with the function Binom.Confint(x,n,"method"=lrt).
>> For likelihood ratio test, I'd like to ask how you define the upper
>> limit when the frequency of successes is zero. Thanks!
> Point 1: This question is inappropriate for this list, since it is about statistical theory and not about R syntax and programming.
>
> Point 2: Where did you find the function Binom.Confint()? I can find no such function anywhere. I did manage to locate a function
> binom.confint() (note the lower case "b" and "c") but it does not have an argument "method". Please do not expect those whom you are addressing to be telepathic.
>
> Point 3: Having "method"=lrt in the call is decidedly weird. Perhaps you meant method="lrt"; this is entirely different.
>
> cheers,
>
> Rolf Turner
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
> ***********************************************************
> Warning: This email may contain confidential or privileged information
> intended only for the use of the individual or entity to whom it is
> addressed. If you are not the intended recipient, please understand
> that any disclosure, copying, distribution, or use of the contents
> of this email is strictly prohibited.
> ***********************************************************
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list