cds2.stats
Statistical tests, summaries and effect sizes on scipy.stats.
Statistical tests and summaries built on scipy.stats.
TestResult
dataclass
Outcome of a statistical hypothesis test.
Source code in src/cds2/stats.py
48 49 50 51 52 53 | |
CorrelationResult
dataclass
Correlation coefficient with its significance test.
Source code in src/cds2/stats.py
56 57 58 59 60 61 | |
DescribeResult
dataclass
Descriptive summary of a numeric sample.
Source code in src/cds2/stats.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
BootstrapResult
dataclass
Bootstrap estimate with standard error and percentile interval.
Source code in src/cds2/stats.py
333 334 335 336 337 338 339 340 | |
StreamingStats
Welford incremental mean/variance for datasets larger than memory.
Source code in src/cds2/stats.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
describe(data)
Full descriptive summary (moments + quantiles) of a sample.
Source code in src/cds2/stats.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
t_test(sample, popmean=0.0)
One-sample t-test of the sample mean against popmean.
Source code in src/cds2/stats.py
159 160 161 162 163 164 | |
independent_t_test(a, b, equal_var=True)
Two-sample t-test; equal_var=False runs Welch's variant.
Source code in src/cds2/stats.py
167 168 169 170 | |
paired_t_test(a, b)
Paired-samples t-test on two related samples.
Source code in src/cds2/stats.py
173 174 175 176 177 | |
anova(*groups)
One-way analysis of variance F-test across two or more groups.
Source code in src/cds2/stats.py
180 181 182 183 184 185 186 187 | |
kruskal_wallis(*groups)
Non-parametric Kruskal-Wallis H-test across groups.
Source code in src/cds2/stats.py
190 191 192 193 194 195 196 | |
mann_whitney_u(a, b)
Mann-Whitney U rank test comparing two independent samples.
Source code in src/cds2/stats.py
199 200 201 202 | |
wilcoxon_signed_rank(a, b)
Wilcoxon signed-rank test for paired samples.
Source code in src/cds2/stats.py
205 206 207 208 209 | |
normality_test(data)
Shapiro-Wilk test of normality; requires at least three observations.
Source code in src/cds2/stats.py
212 213 214 215 | |
levene_test(*groups)
Levene test for equality of variances across groups.
Source code in src/cds2/stats.py
218 219 220 221 222 223 224 | |
pearson_correlation(x, y)
Correlation between equal-length finite, non-constant samples.
Source code in src/cds2/stats.py
227 228 229 230 231 232 233 | |
spearman_correlation(x, y)
Correlation between equal-length finite, non-constant samples.
Source code in src/cds2/stats.py
236 237 238 239 240 241 242 | |
kendall_tau(x, y)
Correlation between equal-length finite, non-constant samples.
Source code in src/cds2/stats.py
245 246 247 248 249 250 251 | |
chi_square_independence(table)
Chi-square test of independence on a valid contingency table.
Source code in src/cds2/stats.py
254 255 256 257 258 | |
cohens_d(a, b)
Cohen's d standardized mean difference with pooled sample SD.
Source code in src/cds2/stats.py
261 262 263 264 265 266 267 268 | |
eta_squared_from_f(f_statistic, df1, df2)
Eta-squared effect size derived from a non-negative ANOVA F statistic.
Source code in src/cds2/stats.py
271 272 273 274 275 276 277 | |
cramers_v(table)
Cramer's V association strength from a contingency table in [0, 1].
Source code in src/cds2/stats.py
280 281 282 283 284 285 286 | |
percentile(data, q)
Percentile(s) of a sample for q in [0, 100].
Source code in src/cds2/stats.py
289 290 291 292 293 294 295 296 297 | |
z_scores(data)
Standardize a sample to zero mean and unit sample standard deviation.
Source code in src/cds2/stats.py
300 301 302 303 304 305 306 | |
norm_pdf(x, mu=0.0, sigma=1.0)
Normal distribution helper with validated location and scale.
Source code in src/cds2/stats.py
309 310 311 312 313 314 | |
norm_cdf(x, mu=0.0, sigma=1.0)
Normal distribution helper with validated location and scale.
Source code in src/cds2/stats.py
317 318 319 320 321 322 | |
norm_ppf(q, mu=0.0, sigma=1.0)
Inverse normal CDF for a probability in [0, 1].
Source code in src/cds2/stats.py
325 326 327 328 329 330 | |
bootstrap_ci(data, statistic=None, n_resamples=10000, confidence=0.95, seed=None)
Percentile bootstrap confidence interval for an arbitrary scalar statistic.
Source code in src/cds2/stats.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
permutation_test(a, b, n_permutations=10000, seed=None)
Two-sided permutation test on the difference of means.
Source code in src/cds2/stats.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
covariance_matrix(data)
Sample covariance matrix of column-variables (rows = observations).
Source code in src/cds2/stats.py
411 412 413 414 | |
correlation_matrix(data)
Pearson correlation matrix of non-constant column-variables.
Source code in src/cds2/stats.py
417 418 419 420 421 422 | |
multivariate_normal_logpdf(x, mean, cov)
Log-density of a multivariate normal at a single point.
Source code in src/cds2/stats.py
425 426 427 428 429 430 431 432 433 434 | |