Can we solve for lambda in R? Assuming a poisson distribution, is there a way to solve for lambda in R?
My inputs would be "x", and Pr(X<=x) ... and I would like R to tell me the lambda.
Thanks

If you have $Pr(X \leq x)$ then you have evaluations of cumulative mass function. The solution is simply a matter of curve fitting at that point.  Here is some R code to do so

set.seed(0)
mystery_lambda = rgamma(1, 5, 2)

# What you start with
x = 0:10
cumulative_mass = ppois(x, mystery_lambda)

target = function(log_lam){
  # Lambda is constrained to be positive
  # so we optimize over log lambda which us unconstrained
  # and then apply exp to make it positive.
  # Standard truck
  target_cum_mass = ppois(x, exp(log_lam))
  
  mean((cumulative_mass - target_cum_mass)^2)
}


results = optim(0, target, method = 'BFGS')

estimated_lambda = exp(results$par)

print(estimated_lambda)
[1] 3.788946

print(mystery_lambda)
[1] 3.788947

```

