Poisson Distribution and Instance :: Math
Hi.
How do you determine an instance of a Poisson Distribution?
Given:
A car passes through a deserted intersection on average every five minutes.
average = 5 minutes
Question: What is an estimate (instance) of the number of cars that passed through this intersection in a period of four week?
I understand how to do the time conversion, but I do not understand how to get the Poisson instance when given the condition such as the one above.
Thanks,
Kuphryn
int poisson(double lambda){
int value=0;
for(double r=instance_of_uniform_distribution(0,1);r>0;++value)
r-=poisson_probability(lambda, value);
return value;
}
Okay. Thanks.
Can you explain your solution?
What function is instance_of_uniform_distribution()? Is that from C/C++ library? How about poisson_probability()?
Lastly, what does function poisson() return? If possible, please give an example with input data.
Kuphryn
Can you explain your solution?
What function is instance_of_uniform_distribution()? Is that from C/C++ library? How about poisson_probability()?
Lastly, what does function poisson() return? If possible, please give an example with input data.
Kuphryn
instance_of_uniform_distribution() and poisson_probability() are placeholders. You should provide those functions. Something like
double instance_of_uniform_distribution(){ return (double)rand()/RAND_MAX;}double poisson_probability(double lambda, int value){ double v = exp(-lambda)*pow(lambda,value); for(;value>1;--value) v/=value; return v;}[source]
Nice!!!
Given: average = 5 minutes.
Time: t = 0
I assume poisson will return the time based on previous time.
t0 = 0
t1 = poisson(t0)
t2 = t1 + poisson(t1)
...
Correct? In other words, lamba is based on t-1.
Kuphryn
Given: average = 5 minutes.
Time: t = 0
I assume poisson will return the time based on previous time.
t0 = 0
t1 = poisson(t0)
t2 = t1 + poisson(t1)
...
Correct? In other words, lamba is based on t-1.
Kuphryn
Err... No.
The Poisson distribution gives you the number of cars in a given period of time. For instance, if a car passes on average every five minutes and you want to generate an instance of how many cars passed in four weeks, you should call poisson(4weeks/5minutes).
If you want to generate an instance of how long you have to wait for the next car to pass, you should use the exponential distribution.
The Poisson distribution gives you the number of cars in a given period of time. For instance, if a car passes on average every five minutes and you want to generate an instance of how many cars passed in four weeks, you should call poisson(4weeks/5minutes).
If you want to generate an instance of how long you have to wait for the next car to pass, you should use the exponential distribution.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement