Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2.. _statsrefmanual: 

3 

4========================================== 

5Statistical functions (:mod:`scipy.stats`) 

6========================================== 

7 

8.. currentmodule:: scipy.stats 

9 

10This module contains a large number of probability distributions as 

11well as a growing library of statistical functions. 

12 

13Each univariate distribution is an instance of a subclass of `rv_continuous` 

14(`rv_discrete` for discrete distributions): 

15 

16.. autosummary:: 

17 :toctree: generated/ 

18 

19 rv_continuous 

20 rv_discrete 

21 rv_histogram 

22 

23Continuous distributions 

24======================== 

25 

26.. autosummary:: 

27 :toctree: generated/ 

28 

29 alpha -- Alpha 

30 anglit -- Anglit 

31 arcsine -- Arcsine 

32 argus -- Argus 

33 beta -- Beta 

34 betaprime -- Beta Prime 

35 bradford -- Bradford 

36 burr -- Burr (Type III) 

37 burr12 -- Burr (Type XII) 

38 cauchy -- Cauchy 

39 chi -- Chi 

40 chi2 -- Chi-squared 

41 cosine -- Cosine 

42 crystalball -- Crystalball 

43 dgamma -- Double Gamma 

44 dweibull -- Double Weibull 

45 erlang -- Erlang 

46 expon -- Exponential 

47 exponnorm -- Exponentially Modified Normal 

48 exponweib -- Exponentiated Weibull 

49 exponpow -- Exponential Power 

50 f -- F (Snecdor F) 

51 fatiguelife -- Fatigue Life (Birnbaum-Saunders) 

52 fisk -- Fisk 

53 foldcauchy -- Folded Cauchy 

54 foldnorm -- Folded Normal 

55 frechet_r -- Deprecated. Alias for weibull_min 

56 frechet_l -- Deprecated. Alias for weibull_max 

57 genlogistic -- Generalized Logistic 

58 gennorm -- Generalized normal 

59 genpareto -- Generalized Pareto 

60 genexpon -- Generalized Exponential 

61 genextreme -- Generalized Extreme Value 

62 gausshyper -- Gauss Hypergeometric 

63 gamma -- Gamma 

64 gengamma -- Generalized gamma 

65 genhalflogistic -- Generalized Half Logistic 

66 geninvgauss -- Generalized Inverse Gaussian 

67 gilbrat -- Gilbrat 

68 gompertz -- Gompertz (Truncated Gumbel) 

69 gumbel_r -- Right Sided Gumbel, Log-Weibull, Fisher-Tippett, Extreme Value Type I 

70 gumbel_l -- Left Sided Gumbel, etc. 

71 halfcauchy -- Half Cauchy 

72 halflogistic -- Half Logistic 

73 halfnorm -- Half Normal 

74 halfgennorm -- Generalized Half Normal 

75 hypsecant -- Hyperbolic Secant 

76 invgamma -- Inverse Gamma 

77 invgauss -- Inverse Gaussian 

78 invweibull -- Inverse Weibull 

79 johnsonsb -- Johnson SB 

80 johnsonsu -- Johnson SU 

81 kappa4 -- Kappa 4 parameter 

82 kappa3 -- Kappa 3 parameter 

83 ksone -- Distribution of Kolmogorov-Smirnov one-sided test statistic 

84 kstwo -- Distribution of Kolmogorov-Smirnov two-sided test statistic 

85 kstwobign -- Limiting Distribution of scaled Kolmogorov-Smirnov two-sided test statistic. 

86 laplace -- Laplace 

87 levy -- Levy 

88 levy_l 

89 levy_stable 

90 logistic -- Logistic 

91 loggamma -- Log-Gamma 

92 loglaplace -- Log-Laplace (Log Double Exponential) 

93 lognorm -- Log-Normal 

94 loguniform -- Log-Uniform 

95 lomax -- Lomax (Pareto of the second kind) 

96 maxwell -- Maxwell 

97 mielke -- Mielke's Beta-Kappa 

98 moyal -- Moyal 

99 nakagami -- Nakagami 

100 ncx2 -- Non-central chi-squared 

101 ncf -- Non-central F 

102 nct -- Non-central Student's T 

103 norm -- Normal (Gaussian) 

104 norminvgauss -- Normal Inverse Gaussian 

105 pareto -- Pareto 

106 pearson3 -- Pearson type III 

107 powerlaw -- Power-function 

108 powerlognorm -- Power log normal 

109 powernorm -- Power normal 

110 rdist -- R-distribution 

111 rayleigh -- Rayleigh 

112 rice -- Rice 

113 recipinvgauss -- Reciprocal Inverse Gaussian 

114 semicircular -- Semicircular 

115 skewnorm -- Skew normal 

116 t -- Student's T 

117 trapz -- Trapezoidal 

118 triang -- Triangular 

119 truncexpon -- Truncated Exponential 

120 truncnorm -- Truncated Normal 

121 tukeylambda -- Tukey-Lambda 

122 uniform -- Uniform 

123 vonmises -- Von-Mises (Circular) 

124 vonmises_line -- Von-Mises (Line) 

125 wald -- Wald 

126 weibull_min -- Minimum Weibull (see Frechet) 

127 weibull_max -- Maximum Weibull (see Frechet) 

128 wrapcauchy -- Wrapped Cauchy 

129 

130Multivariate distributions 

131========================== 

132 

133.. autosummary:: 

134 :toctree: generated/ 

135 

136 multivariate_normal -- Multivariate normal distribution 

137 matrix_normal -- Matrix normal distribution 

138 dirichlet -- Dirichlet 

139 wishart -- Wishart 

140 invwishart -- Inverse Wishart 

141 multinomial -- Multinomial distribution 

142 special_ortho_group -- SO(N) group 

143 ortho_group -- O(N) group 

144 unitary_group -- U(N) group 

145 random_correlation -- random correlation matrices 

146 

147Discrete distributions 

148====================== 

149 

150.. autosummary:: 

151 :toctree: generated/ 

152 

153 bernoulli -- Bernoulli 

154 betabinom -- Beta-Binomial 

155 binom -- Binomial 

156 boltzmann -- Boltzmann (Truncated Discrete Exponential) 

157 dlaplace -- Discrete Laplacian 

158 geom -- Geometric 

159 hypergeom -- Hypergeometric 

160 logser -- Logarithmic (Log-Series, Series) 

161 nbinom -- Negative Binomial 

162 planck -- Planck (Discrete Exponential) 

163 poisson -- Poisson 

164 randint -- Discrete Uniform 

165 skellam -- Skellam 

166 zipf -- Zipf 

167 yulesimon -- Yule-Simon 

168 

169An overview of statistical functions is given below. 

170Several of these functions have a similar version in 

171`scipy.stats.mstats` which work for masked arrays. 

172 

173Summary statistics 

174================== 

175 

176.. autosummary:: 

177 :toctree: generated/ 

178 

179 describe -- Descriptive statistics 

180 gmean -- Geometric mean 

181 hmean -- Harmonic mean 

182 kurtosis -- Fisher or Pearson kurtosis 

183 mode -- Modal value 

184 moment -- Central moment 

185 skew -- Skewness 

186 kstat -- 

187 kstatvar -- 

188 tmean -- Truncated arithmetic mean 

189 tvar -- Truncated variance 

190 tmin -- 

191 tmax -- 

192 tstd -- 

193 tsem -- 

194 variation -- Coefficient of variation 

195 find_repeats 

196 trim_mean 

197 gstd -- Geometric Standard Deviation 

198 iqr 

199 sem 

200 bayes_mvs 

201 mvsdist 

202 entropy 

203 median_absolute_deviation 

204 median_abs_deviation 

205 

206Frequency statistics 

207==================== 

208 

209.. autosummary:: 

210 :toctree: generated/ 

211 

212 cumfreq 

213 itemfreq 

214 percentileofscore 

215 scoreatpercentile 

216 relfreq 

217 

218.. autosummary:: 

219 :toctree: generated/ 

220 

221 binned_statistic -- Compute a binned statistic for a set of data. 

222 binned_statistic_2d -- Compute a 2-D binned statistic for a set of data. 

223 binned_statistic_dd -- Compute a d-D binned statistic for a set of data. 

224 

225Correlation functions 

226===================== 

227 

228.. autosummary:: 

229 :toctree: generated/ 

230 

231 f_oneway 

232 pearsonr 

233 spearmanr 

234 pointbiserialr 

235 kendalltau 

236 weightedtau 

237 linregress 

238 siegelslopes 

239 theilslopes 

240 multiscale_graphcorr 

241 

242Statistical tests 

243================= 

244 

245.. autosummary:: 

246 :toctree: generated/ 

247 

248 ttest_1samp 

249 ttest_ind 

250 ttest_ind_from_stats 

251 ttest_rel 

252 chisquare 

253 power_divergence 

254 kstest 

255 ks_1samp 

256 ks_2samp 

257 epps_singleton_2samp 

258 mannwhitneyu 

259 tiecorrect 

260 rankdata 

261 ranksums 

262 wilcoxon 

263 kruskal 

264 friedmanchisquare 

265 brunnermunzel 

266 combine_pvalues 

267 jarque_bera 

268 

269.. autosummary:: 

270 :toctree: generated/ 

271 

272 ansari 

273 bartlett 

274 levene 

275 shapiro 

276 anderson 

277 anderson_ksamp 

278 binom_test 

279 fligner 

280 median_test 

281 mood 

282 skewtest 

283 kurtosistest 

284 normaltest 

285 

286Transformations 

287=============== 

288 

289.. autosummary:: 

290 :toctree: generated/ 

291 

292 boxcox 

293 boxcox_normmax 

294 boxcox_llf 

295 yeojohnson 

296 yeojohnson_normmax 

297 yeojohnson_llf 

298 obrientransform 

299 sigmaclip 

300 trimboth 

301 trim1 

302 zmap 

303 zscore 

304 

305Statistical distances 

306===================== 

307 

308.. autosummary:: 

309 :toctree: generated/ 

310 

311 wasserstein_distance 

312 energy_distance 

313 

314Random variate generation 

315========================= 

316 

317.. autosummary:: 

318 :toctree: generated/ 

319 

320 rvs_ratio_uniforms 

321 

322Circular statistical functions 

323============================== 

324 

325.. autosummary:: 

326 :toctree: generated/ 

327 

328 circmean 

329 circvar 

330 circstd 

331 

332Contingency table functions 

333=========================== 

334 

335.. autosummary:: 

336 :toctree: generated/ 

337 

338 chi2_contingency 

339 contingency.expected_freq 

340 contingency.margins 

341 fisher_exact 

342 

343Plot-tests 

344========== 

345 

346.. autosummary:: 

347 :toctree: generated/ 

348 

349 ppcc_max 

350 ppcc_plot 

351 probplot 

352 boxcox_normplot 

353 yeojohnson_normplot 

354 

355 

356Masked statistics functions 

357=========================== 

358 

359.. toctree:: 

360 

361 stats.mstats 

362 

363 

364Univariate and multivariate kernel density estimation 

365===================================================== 

366 

367.. autosummary:: 

368 :toctree: generated/ 

369 

370 gaussian_kde 

371 

372Warnings used in :mod:`scipy.stats` 

373=================================== 

374 

375.. autosummary:: 

376 :toctree: generated/ 

377 

378 F_onewayConstantInputWarning 

379 F_onewayBadInputSizesWarning 

380 PearsonRConstantInputWarning 

381 PearsonRNearConstantInputWarning 

382 SpearmanRConstantInputWarning 

383 

384For many more stat related functions install the software R and the 

385interface package rpy. 

386 

387""" 

388from .stats import * 

389from .distributions import * 

390from .morestats import * 

391from ._binned_statistic import * 

392from .kde import gaussian_kde 

393from . import mstats 

394from .contingency import chi2_contingency 

395from ._multivariate import * 

396 

397__all__ = [s for s in dir() if not s.startswith("_")] # Remove dunders. 

398 

399from scipy._lib._testutils import PytestTester 

400test = PytestTester(__name__) 

401del PytestTester