colinfang
colinfang

Reputation: 21757

Is there a function or package in R that can get lambda of poisson distribution from quantile and probability?

for example, F(X = 2 | lambda = 2.3) = 0.596 I know 2 and 0.596 and I would like to get lambda.

I know I can do it by numerical approximation algorithms.

However before I manually create a function, is there an existing function that I can simply use?

Update

It is a shame that I have to use numerical method. I had thought there is a popular well known analytic method / close form.

Upvotes: 1

Views: 3116

Answers (1)

Richie Cotton
Richie Cotton

Reputation: 121127

Optimization is probably the way to go with this.

f <- function(lambda) abs(ppois(2, lambda) - 0.5960388)
optimize(f, c(0, 10))

Or, as Ben B suggested,

f2 <- function(lambda) ppois(2, lambda) - 0.5960388
uniroot(f2, c(0, 10))

Upvotes: 7

Related Questions