0

I searched a while and could't find any probability distribution that fits my needs. The Distribution should look something like the function c1 * x^2 + c2. The closest I could find in numpy is the Beta Distribution with alpha=0.5 and beta=0.5. But I don't like the plain area in the middle of it. Someone has any ideas?

Marvin K
  • 334
  • 3
  • 14
  • 2
    As written, this question can only invite people randomly trying things in an attempt to discover whatever it is the OP likes, which isn't a recipe for a good SO question. – DSM Nov 20 '18 at 16:16
  • *"... could't find any probability distribution that fits my needs."* Explain your needs in more detail; *"something like the function c1 * x^2 + c2"* is vague, as is *"I don't like the plain area in the middle of it"*. – Warren Weckesser Nov 20 '18 at 16:22
  • Also, once you've figured out a more precise set of requirements for the distribution, I think the question will be more appropriate for the [Cross Validated](https://stats.stackexchange.com/) site. – Warren Weckesser Nov 20 '18 at 16:24
  • could you provide picture of the histogram? – Severin Pappadeux Nov 20 '18 at 16:31

1 Answers1

1

You can create your own distributions using scipy.stats.rv_continous

Example of how to use it:

from scipy.stats import rv_continuous

def my_pdf_function(x, c1, c2):
    return (x**2 * c1 + c2)

class cuadratic_distribution(rv_continuous):
    def _pdf(self, x):
        # For example: c1=1, c2=2/3 (normalized between x=0 and x=1)
        return my_pdf_function(x, c1=1, c2=2/3)

my_pdf = cuadratic_distribution(a=0, b=1, name='my_pdf')

my_pdf.cdf([-1, 0.4, 2])
>>> array([0.   , 0.316, 1.   ])

Note that you should set appropiately the boundaries of the distribution (a and b), and the correspondant values of c1 and c2 to ensure 0 < P(x) < 1 and that the integral of P(x) yields 1

Tarifazo
  • 4,118
  • 1
  • 9
  • 22