Home python WHY SCIPY.NORM.PDF (probability density function) may be greater than

WHY SCIPY.NORM.PDF (probability density function) may be greater than

Author

Date

Category

Tell me please:
There are a number y ~ i (1), i.e. integrated first order (non-stationary). To bring to stationarity I use the increment of logarithm. The problem is that when the density function is displayed, according to Oy, where there should be probabilities in decimal form more than one. With a nuclear assessment, the same. The teacher wants the increment of logarithm.

import numpy as np
Import schipy.stats AS STS
np.random.seed (123)
y = np.linspace (50,200,150) + np.random.normal (Loc = 0, Scale = 15, Size = 150)
x = np.diff (np.log (y))
MU, SIGMA = STS.NORM.FIT (X)
xmin, xmax = x.min (), x.max ()
x_l = np.linspace (Xmin, Xmax, Len (X))
DENS = STS.NORM.PDF (X_L, LOC = MU, SCALE = SIGMA)
Plt.plot (X_L, DENS)
DENS_KDE = STS.GAUSSIAN_KDE (X)
DENS_PDF = DENS_KDE.EVALUATE (X_L)
Plt.plot (X_L, DENS_PDF)

Answer 1, Authority 100%

sts.norm.pdf probability density function (probability density function) can return values ​​more than one, but if it is integrated, the value is close to one:

in [152]: from scipy.integrarate import simps
In [153]: SIMPS (DENS, X = X_L)
Out [153]: 0.999763132933244

More about it You can read in this issue / answer in the English version of SO

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions