I am trying to generate scipy.stats.pareto.rvs(b, loc=0, scale=1, size=1) with different seed.
In numpy we can seed using numpy.random.seed(seed=233423).
Is there any way to seed the random number generated by scipy stats.
Note: I am not using numpy pareto because I want to give different values for scale.
Exponential Distribution in Python stats module's expon. rvs() method which takes shape parameter scale as its argument which is nothing but 1/lambda in the equation. To shift distribution use the loc argument, size decides the number of random variates in the distribution.
rvs: Random Variates. pdf: Probability Density Function. cdf: Cumulative Distribution Function.
In the above program, first, we need to import the norm module from the scipy. stats, then we passed the data as Numpy array in the cdf() function. To get the median of the distribution, we can use the Percent Point Function (PPF), this is the inverse of the CDF.
stats ) This module contains a large number of probability distributions, summary and frequency statistics, correlation functions and statistical tests, masked statistics, kernel density estimation, quasi-Monte Carlo functionality, and more.
scipy.stats
just uses numpy.random
to generate its random numbers, so numpy.random.seed()
will work here as well. E.g.,
import numpy as np from scipy.stats import pareto b = 0.9 np.random.seed(seed=233423) print pareto.rvs(b, loc=0, scale=1, size=5) np.random.seed(seed=233423) print pareto.rvs(b, loc=0, scale=1, size=5)
will print [ 9.7758784 10.78405752 4.19704602 1.19256849 1.02750628]
twice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With