📜  scipy stats.dgamma() | Python(1)

📅  最后修改于: 2023-12-03 15:20:00.232000             🧑  作者: Mango

scipy stats.dgamma() | Python

Introduction

The scipy.stats.dgamma() function in Python is a part of the scipy library which provides various statistical functions. In particular, it allows us to work with the double gamma continuous random variable. This function can be used to perform calculations and generate random samples from the double gamma distribution.

Function Signature

The syntax of the scipy.stats.dgamma() function is as follows:

scipy.stats.dgamma(a, loc=0, scale=1)
Parameters

The scipy.stats.dgamma() function takes the following parameters:

  • a (float) : Shape parameter of the distribution
  • loc (float) : Optional parameter representing the location of the peak. Default is 0.
  • scale (float) : Optional parameter representing the scale of the distribution. Default is 1.
Returns

The scipy.stats.dgamma() function returns a double gamma continuous random variable object.

Example Usage

Here is an example usage of the scipy.stats.dgamma() function to generate random samples from the double gamma distribution:

import scipy.stats as stats

# Generate random samples from double gamma distribution
samples = stats.dgamma.rvs(a=2, loc=1, scale=2, size=100)

print(samples)

In the above example, we import the scipy.stats module and use the dgamma.rvs() method to generate 100 random samples from a double gamma distribution with shape parameter a=2, location parameter loc=1, and scale parameter scale=2. The generated samples are then printed.

References

For more information on the scipy.stats.dgamma() function and its usage, you can refer to the official documentation: