I've been playing around with Bayesian / Probabilistic Programming with PyMC and others. I can't find a ton of great practical examples on the web so I created my own problem and tried to solve it. Can someone sanity check it for me to make sure I'm "doing it right"? (It's short): https://storage.googleapis.com/static-web-1/Risk%20Analysis.html

Here's what it's trying to do:

  • I want to model the Probability of a pretend business breaking even every single day.
  • The business has 10 customers that can have variable distributions of usage.
  • I model the customers' usage as 10 different gamma distributions (first question: are gammas appropriate for this?)
  • I assume uniform priors on the alpha & beta for the gammas and then use the observed data (usage_i) to infer what they should be.
  • Once, I inferred what the alpha & beta should be for every customer, I randomly sample from that gamma (inf_usage_i).
  • Then I combine the sum of the sampled usages with a fixed cost, a variable cost (assumed normal r.v. but presumably this can be inferred from historical data too) and constant price. I sample this to draw a distribution of profits.

Does this make sense? One thing that bothers me is that it seems weird to first infer the alpha & betas and then immediately sample again from the corresponding gammas that they define by creating a new variable. I guess this is a necessary evil when I want to infer the distribution and use it somewhere?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.