forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 7:21 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: invpoissondistribution
PostPosted: Thu Jan 26, 2012 12:07 am 
Offline

Joined: Wed Jan 25, 2012 11:57 pm
Posts: 1
Hi everyone,

I use alglib as a random number generator and ,in particular, i am working with the function invpoissondistribution to simulate a random variable following a poisson.
However, with this piece of code,
{
double Demand[1000];
double mean(0);
for(int i(0);i<1000;i++)
{
Demand[i]=invpoissondistribution(40,randomreal());

mean=Demand[i]+mean;
}
return mean/1000;
}

I get that the mean is approximately 41 (41.15 exactly). How is that possible when the mean should be 40 ? What do I miss ?

Thanks,


Top
 Profile  
 
 Post subject: Re: invpoissondistribution
PostPosted: Fri Jan 27, 2012 5:37 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Asymptotic mean should be 40, but finite-sample mean can deviate from asymptotic value with average error roughly proportional to 1/sqrt(sample_size). If you increase sample size from 1000 to 100000 you should see ten times smaller error.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 36 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group