scipy.stats.foldcauchy () is een gevouwen continue Cauchy-willekeurige variabele die is gedefinieerd in een standaardformaat en met enkele vormparameters om de specificatie te voltooien.

Parameters:
- > q: onder- en bovenstaartwaarschijnlijkheid
- > a: vormparameters
- > x: kwantielen
- > loc: [optioneel] locatieparameter. Standaard = 0
- > schaal: [optioneel] schaalparameter. Standaard = 1
- > grootte: [tupel van ints, optioneel] vorm of willekeurige variaties.
- > momenten: [optioneel] samengesteld uit letters [`mvsk`]; `m` = gemiddelde, `v` = variantie, `s` = Fisher`s skew en `k` = Fisher`s kurtosis. (default = `mv`).Resultaten: gevouwen Cauchy continue willekeurige variabele
Code # 1: Maak een gevouwen Cauchy continue willekeurige variabele Cauchy willekeurige variabele
from
scipy.stats
import
foldcauchy
aantal
=
foldcauchy.numargs
[a]
=
[
0,7
,]
*
getallen
rv
=
foldcauchy (a)
print
(
"RV:"
, rv)
Afsluiten:
RV: "scipy.stats._distn_infrastructure.rv_frozen object op 0x0000018D55D8E160 >
Code #2: de gevouwen Cauchy toevalsvariabelen en de kansverdelingsfunctie.
import
numpy as np
kwantiel
=
np.arange (
0,01
,
1
,
0.1
)
# Willekeurige varianten
R
=
foldcauchy .rvs (a, schaal
=
2
, grootte
=
10
)
print
(
"Willekeurige variaties:"
, R )
# PDF
R
=
foldcauchy.pdf (a, quantile, loc
=
0
, schaal
=
1
)
print
(
"Kansverdeling:"
, R)
Uitvoer:
Willekeurige variaties: [1.7445128 2.82630984 0.81871044 5.19668279 7.81537565 1.67855736 3.35417067 0.13838753 1.29145462 1.90601065] Waarschijnlijkheidsverdeling: [0.42727064 0.42832192 0.430803143 0.4622298083143. 0,4 3294602 0,42480391 0,41154712 0,3934792]
Code # 3: Grafische weergave.
import
numpy as np
import
matplotlib.pyplot als plt
distributie
=
np.linspace (
0
, np.minimum (rv.dist. b,
3
))
print
(
" Distributie:"
, distributie)
plot
=
plt.plot (distributie, rv.pdf (distributie))
Uitvoer:
Distributie: [0. 0.06122449 0.12244898 0.18367347 0.24489796 0.30612245 0.36734694 0.42857143 0.48979592 0.55102041 0.6122449 0.67346939 0.73469388 0.79591837 0.85714286 0.91836735 0.97959184 1.04081633 1.10204082 1.16326531 1.2244898 1.28571429 1.34693878 1.40816327 1.46938776 1.53061224 1.59183673 1.65306122 1.71428571 1.7755102 1.83673469 1.89795918 1.95918367 2.02040816 2.08163265 2.14285714 2.20408163 2.26530612 2.32653061 2.3877551 2.44897959 2.51020408 2.57142857 2.63265306 2.69387755 2.75510204 2.81632653 2.87755102 2.93877551 3. ]
Code #4: verschillende positionele argumenten
import
matplotlib. pyplot als plt
import
numpy als np
x
=
np.linspace (
0
,
5
,
100
)
# Diverse positionele argumenten
y1
=
foldcauchy.pdf (x,
1
,
3
)
y2
=
foldcauchy.pdf (x,
1
,
4
)
plt.plot (x, y1,
"*"
, x, y2,
"r--"
)
Uitvoer:
