Page 1 of 1

Estimation based on ratios

Posted: Sun Sep 26, 2010 5:25 pm
by jabbaonthedais
I am developing a browser-based game in PHP and I am trying to find the best way to do something. I wondered if some fresh eyes could help me out.

Users will have a store and I need to calculate sales they get based on an average ratio. Let's say 1 out of 35 customers typically make a purchase. If they get 350 customers a day, they would average 10 sales a day. But thats too exact, and its not real. If you take that ratio to real life, each customer has a 1:35 chance of making a sale, and therefore you could have 2 or more in a row. I want to have a bit more realism but something that makes sense using that average ratio. I could do a loop for each customer, but I need code that can scale with potentially thousands of users and thousands of virtual customers.

Could I make 35 (or whatever my 1: ratio is) a weight for picking a random number, that would much more likely be 30-40 rather than 100?

If I can explain something better please let me know. Thanks in advance for your help! :)

Re: Estimation based on ratios

Posted: Mon Sep 27, 2010 1:36 am
by McInfo
Where do your numbers come from? I'm referring to "1 purchase per 35 customers" and "350 customers per day". Will those be based on data gathered during the game or are they predetermined at some point?

I did some research and discovered that a graph of randomly-generated sales volumes based on your criteria looks a little bit like a cosine curve with a peak near the average sales per day. Maybe there is a mathematical expression you could plug a random number into to get a sales-per-day figure where the likelihood of getting a particular figure is weighted as you described.

Re: Estimation based on ratios

Posted: Mon Sep 27, 2010 12:11 pm
by jabbaonthedais
The number of customers will be based on different action the user takes (promotion and advertisements for store, etc.) and the ratio will depend on items the user keeps in stock, so they will fluctuate.

I think you're right about there having to be an expression to solve this. I just need to find one or figure one out. :P

Thanks!