how i can generate random poisson distribution in 2 digits decimal

if i am doing this its returning in integers
rpois(5,33.45:33.75)
#[1] 38 34 27 31 24

What would expect to see, instead?

The poisson distribution represents probabilities of counts of events. The lambda parameter is the mean expected number of events, but the actual random draws from the distribution (that is, the individual realizations of the poisson process) will be integers representing the number of counts actually observed.

For example, if we draw 100,000 values (100,000 individual realizations) for a poisson process with lambas of, respectively, 3, 3.4, and 3.95, the plots below show how many times we get 0 events, 1 event, 2 events, etc. for the 100,000 random draws. Note that all of the random draws are integers:

par(mfrow=c(3,1))
plot(table(rpois(1e5, 3)), xlim=c(0,15), main="lambda=3")
plot(table(rpois(1e5, 3.4)), xlim=c(0,15), main="lambda=3.4")
plot(table(rpois(1e5, 3.95)), xlim=c(0,15), main="lambda=3.95")

1 Like

i need answer in decimal as i want lat and long in 2 decimal places

I guess a question, then, is what role does rpois() plays in the problem you're trying to solve?

2 Likes

as arrival rate in queing model theory follows poison distribution so i wana use it

I can't understand how the arrival rate could be related to geographic coordinates, can you explain your logic?

The arrival rate is the lambda parameter in rpois. This is the average number of events (arrivals in this case) within a given time period. But the actual number of arrivals in any given value drawn from this distribution will be an integer. For example, you could do x=rpois(1000, 3.5), representing 3.5 arrivals (per unit time period). If you do mean(x) you'll see it's very close to 3.5. But the individual draws will all be integers, because the actual number of arrivals is discrete.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.