4

I am new to Python and new to SciPy libraries. I wanted to take some ques from the experts here on the list before dive into SciPy world.

I was wondering if some one could provide a rough guide about how to run two stats functions: Cumulative Distribution Function (CDF) and Probability Distribution Function (PDF).

My use case is the following: I have a sampleSpaceList [] which have 1000 floating point values. When a new floating point value is generated in my program, I would like to run both CDF and PDF on the sampleList for it and get the probability of value less or equal for CDF and probability distribution for PDF.

some more information

Basically, in my program there are events which can either succeed or fail. If they succeed, then I calculate a event-ratio for that event and add to my sampleSpaceList until it reaches a threshold of 1000. Once the threshold is achieved, then for any next event-ratio; I would like to get a probability that whether that event-ratio would succeed or not in my system.

What I basically would like to get is the probability of success for a particular event ratio.

I am not very sure whether CDF or PDF will be relative to my problem so that 's why I wanted to learn how to use both but at any given moment, I will be only using either CDF or PDF to get a probability of event-ratio being successful.

Cœur
  • 37,241
  • 25
  • 195
  • 267
okm
  • 283
  • 6
  • 18
  • 2
    Can you explain what do you mean by "run both CDF and PDF on the sampleList"? What do you mean by running a function on a list? – Sinan Taifour Jul 20 '09 at 15:57
  • I just updated my problem description regarding your question as I could add more than 600 characters in the comments section. Please have a look.. – okm Jul 20 '09 at 16:13
  • [Here are all the scipy.stats distributions PDFs with example code.](http://stackoverflow.com/a/37559471/2087463) – tmthydvnprt Jun 01 '16 at 04:57

1 Answers1

8

See this article: Probability distributions in SciPy.

John D. Cook
  • 29,517
  • 10
  • 67
  • 94
  • Thanks for the link John to your blog. It partially answered m question but since scipy.stats.norm(mean,deviation) takes mean/deviation before cdf/pdf could be called; i guess i would have to calculate the mean/deviation for the my samplespace[] with floating points. Is there a function in scipy which can take a list and return mean/std.deviation?? Thanks, – okm Jul 20 '09 at 18:51
  • Yes. If you assume your data are normally distributed you can use scipy.stats.mean and scipy.stats.std to find the sample mean and standard deviation. If your data are not normally distributed, look into the fit method on your distribution. – John D. Cook Jul 20 '09 at 19:10
  • So the fit function will take in a sample and return the distribution type for it? And then based on that distribution, one can calculate mean, std and probability right? – okm Jul 20 '09 at 20:16
  • Hi @John D. Cook ... The link is broken, could you add a new link? – slotishtype Oct 11 '11 at 10:16