On 11 Feb 2015, at 17:11 , Chel Hee Lee <[email protected]> wrote:
> The functional form given in the post written by Ssuhanchen captures my eyes.
> It is the cumulative distribution function of Poisson when the number of
> counts is less than or equal to 2 with unknown parameter mu=x/2. Since it
> is a nonlinear function, there may be multiple solutions but the solution
> should be greater than 0 (if I am in the right track). I am assuming this
> functional form is originated from the Poisson. Under this assumption, one
> solution is found as below:
>
> > rt <- uniroot(function(x) ppois(2, lambda=x)-0.05, interval=c(0.5,1),
> > extendInt="yes")
> Warning messages:
> 1: In ppois(2, lambda = x) : NaNs produced
> 2: In ppois(2, lambda = x) : NaNs produced
> 3: In ppois(2, lambda = x) : NaNs produced
> > ppois(2, lambda=rt$root)
> [1] 0.0500001
> > rt$root
> [1] 6.295791
>
> Thus, the solution x would be rt$root*2 (Note that I did not try to find
> other solutions). I hope this helps.
>
Given the Poisson connection, I would pretty strongly expect the solution to be
unique.
Notice also that your rt$root comes out as the upper end of the confidence
interval in
> poisson.test(2, alt="l")
Exact Poisson test
data: 2 time base: 1
number of events = 2, time base = 1, p-value = 0.9197
alternative hypothesis: true event rate is less than 1
95 percent confidence interval:
0.000000 6.295794
sample estimates:
event rate
2
> Chel Hee Lee
>
> On 2/10/2015 2:29 AM, Rolf Turner wrote:
>> On 10/02/15 14:04, Ssuhanchen wrote:
>>> Hi!
>>>
>>> I want to use R to calculate the variable x which is in a complex equation
>>> in below:
>>>
>>> 2
>>> Σ[exp(-x/2)*(x^k)/(2^k*k!)]=0.05
>>> k=0
>>>
>>> how to solve this equation to get the exact x in R?
>>
>> Is this homework? Sure looks like it. Talk to your prof. Or do a bit of
>> work on learning how to use R --- which is presumably the point of the
>> exercise.
>>
>> cheers,
>>
>> Rolf Turner
>>
>
> ______________________________________________
> [email protected] 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.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [email protected] Priv: [email protected]
______________________________________________
[email protected] 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.