Descriptive Statistics
circ_r(alpha=None, w=None, Cbar=None, Sbar=None)
Circular mean resultant vector length (r).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Optional[ndarray]
|
Angles in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
Cbar
|
Optional[float]
|
Precomputed intermediate values |
None
|
Sbar
|
Optional[float]
|
Precomputed intermediate values |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
r |
float
|
Resultant vector length |
References
Implementation of Example 26.5 (Zar, 2010)
Source code in pycircstat2/descriptive.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
circ_mean(alpha, w=None)
Circular mean (m).
or
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
m |
float or NaN
|
Circular mean |
Note
Implementation of Example 26.5 (Zar, 2010)
Source code in pycircstat2/descriptive.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
circ_mean_and_r(alpha, w=None)
Circular mean (m) and resultant vector length (r).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
m |
float or NaN
|
Circular mean |
r |
float
|
Resultant vector length |
Note
Implementation of Example 26.5 (Zar, 2010)
Source code in pycircstat2/descriptive.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
circ_mean_and_r_of_means(circs=None, ms=None, rs=None)
The Mean of a set of Mean Angles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
circs
|
Union[list, None]
|
a list of Circular Objects |
None
|
ms
|
Optional[ndarray]
|
a set of mean angles in radian |
None
|
rs
|
Optional[ndarray]
|
a set of mean resultant vector lengths |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
m |
float
|
mean of means in radian |
r |
float
|
mean of mean resultant vector lengths |
Source code in pycircstat2/descriptive.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
circ_moment(alpha, w=None, p=1, mean=None, centered=False)
Compute the p-th circular moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights. If None, equal weights are used. |
None
|
p
|
int
|
Order of the moment to compute. |
1
|
mean
|
Union[float, ndarray, None]
|
Precomputed circular mean. If None, mean is computed internally. |
None
|
centered
|
bool
|
If True, center alpha by subtracting the mean. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
mp |
complex
|
The p-th circular moment as a complex number. |
Note
Implementation of Equation 2.24 (Fisher, 1993).
Source code in pycircstat2/descriptive.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
circ_dispersion(alpha, w=None, mean=None)
Sample Circular Dispersion, defined by Equation 2.28 (Fisher, 1993):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
mean
|
Precomputed circular mean. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dispersion |
float
|
Sample Circular Dispersion |
Source code in pycircstat2/descriptive.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
circ_skewness(alpha, w=None)
Circular skewness, as defined by Equation 2.29 (Fisher, 1993):
But unlike the implementation of Fisher (1993), here we followed Pewsey et al. (2014) by NOT centering the second moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
skewness |
float
|
Circular Skewness |
Source code in pycircstat2/descriptive.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
circ_kurtosis(alpha, w=None)
Circular kurtosis, as defined by Equation 2.30 (Fisher, 1993):
But unlike the implementation of Fisher (1993), here we followed Pewsey et al. (2014) by NOT centering the second moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
kurtosis |
float
|
Circular Kurtosis |
Source code in pycircstat2/descriptive.py
335 336 337 338 339 340 341 342 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 | |
angular_var(alpha=None, w=None, r=None, bin_size=None)
Angular variance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Optional[ndarray]
|
Angles in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
r
|
Optional[float]
|
Resultant vector length |
None
|
bin_size
|
Optional[float]
|
Interval size of grouped data. Needed for correcting biased r. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
angular_variance |
float
|
Angular variance, range from 0 to 2. |
References
- Batschelet (1965, 1981), from Section 26.5 of Zar (2010)
Source code in pycircstat2/descriptive.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
angular_std(alpha=None, w=None, r=None, bin_size=None)
Angular (standard) deviation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Optional[ndarray]
|
Angles in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
r
|
Optional[float]
|
Resultant vector length |
None
|
bin_size
|
Optional[float]
|
Interval size of grouped data. Needed for correcting biased r. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
angular_std |
float
|
Angular (standard) deviation, range from 0 to sqrt(2). |
References
- Equation 26.20 of Zar (2010)
Source code in pycircstat2/descriptive.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
circ_var(alpha=None, w=None, r=None, bin_size=None)
Circular variance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Optional[ndarray]
|
Angles in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
r
|
Optional[float]
|
Resultant vector length |
None
|
bin_size
|
Optional[float]
|
Interval size of grouped data. Needed for correcting biased r. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
variance |
float
|
Circular variance, range from 0 to 1. |
References
- Equation 2.11 of Fisher (1993)
- Equation 26.17 of Zar (2010)
Source code in pycircstat2/descriptive.py
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 496 497 498 499 500 501 502 | |
circ_std(alpha=None, w=None, r=None, bin_size=None)
Circular standard deviation (s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Optional[ndarray]
|
Angles in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
r
|
Optional[float]
|
Resultant vector length |
None
|
bin_size
|
Optional[float]
|
Interval size of grouped data. Needed for correcting biased r. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
s |
float
|
Circular standard deviation. |
References
Implementation of Equation 26.15-16/20-21 (Zar, 2010)
Source code in pycircstat2/descriptive.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
circ_median(alpha, w=None, method='deviation', return_average=True, average_method='all', verbose=False)
Circular median.
For ungrouped data, the supported methods are (Fisher, 1993; Otieno, 2002):
deviation: angle with minimal circular mean deviation.count: angle that splits the sample equally on either side.HL1,HL2,HL3: Hodges-Lehmann estimates — the deviation-method median of pairwise circular means, with HL1/HL2/HL3 differing in which pairs are used (no self-pairs / with self-pairs / all ordered pairs).
For grouped data, we use the method described in Mardia (1972).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
method
|
Optional[str]
|
|
'deviation'
|
return_average
|
bool
|
Return the average of the median |
True
|
average_method
|
str
|
|
'all'
|
Returns:
| Name | Type | Description |
|---|---|---|
median |
float or NaN
|
|
References
- For ungrouped data: Section 2.3.2 of Fisher (1993)
- For grouped data: Mardia (1972)
- For HL1/HL2/HL3: Otieno, B. S. (2002), "An Alternative Estimate of Preferred Direction for Circular Data", PhD thesis, Virginia Tech, §3.4 and Appendix E.
Source code in pycircstat2/descriptive.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | |
circ_mean_deviation_chunked(alpha, beta, chunk_size=1000)
Optimized circular mean deviation with chunking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
array - like
|
Data in radians. |
required |
beta
|
array - like
|
Reference angles in radians. |
required |
chunk_size
|
int
|
Number of rows to process in chunks (must be positive). |
1000
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Circular mean deviation. |
Source code in pycircstat2/descriptive.py
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | |
circ_mean_deviation(alpha, beta)
Circular mean deviation.
It is the mean angular distance from one data point to all others. The circular median of a set of data should be the point with minimal circular mean deviation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Union[ndarray, float, int, list]
|
Data in radian. |
required |
beta
|
Union[ndarray, float, int, list]
|
reference angle in radian. |
required |
Returns:
| Type | Description |
|---|---|
circular mean deviation: np.array
|
|
Note
eq 2.32, Section 2.3.2, Fisher (1993)
Source code in pycircstat2/descriptive.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | |
circ_mean_ci(alpha=None, w=None, mean=None, r=None, n=None, ci=0.95, method='approximate', B=2000, seed=None, interval='hdi')
Confidence interval of circular mean.
There are three methods to compute the confidence interval of circular mean:
approximate: for n > 8bootstrap: for 8 < n < 25dispersion: for n >= 25
Approximate Method
For n as small as 8, and r \(\le\) 0.9, r \(>\) \(\sqrt{\chi^{2}_{\alpha, 1}/2n}\), the confidence interval can be approximated by:
For r \(\ge\) 0.9,
Bootstrap Method
For 8 \(<\) n \(<\) 25, the confidence interval can be computed by bootstrapping the data.
Dispersion Method
For n \(\ge\) 25, the confidence interval can be computed by the circular dispersion:
where \(\hat\delta\) is the sample circular dispersion (see circ_dispersion). The confidence interval is then:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
Optional[ndarray]
|
Angles in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
mean
|
Optional[float]
|
Precomputed circular mean. |
None
|
r
|
Optional[float]
|
Precomputed resultant vector length. |
None
|
n
|
Union[int, None]
|
Sample size. |
None
|
ci
|
float
|
Confidence interval (default is 0.95). |
0.95
|
method
|
str
|
|
'approximate'
|
B
|
int
|
Number of samples for bootstrap. |
2000
|
seed
|
Optional[Union[int, Generator]]
|
Seed/Generator for reproducible bootstrap. Only used when
|
None
|
interval
|
str
|
How to summarise the bootstrap distribution into an interval. Only
used when
|
'hdi'
|
Returns:
| Name | Type | Description |
|---|---|---|
lower_bound |
float
|
Lower bound of the confidence interval. |
upper_bound |
float
|
Upper bound of the confidence |
References
- Section 26.7, Zar (2010)
- Section 4.4.4a/b, Fisher (1993)
Source code in pycircstat2/descriptive.py
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | |
circ_median_ci(median=None, alpha=None, w=None, method='deviation', ci=0.95)
Confidence interval for circular median
For n > 15, the confidence interval can be computed by:
For n \(\le\) 15, the confidence interval can be selected from the table in Fisher (1993).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
median
|
Optional[float]
|
Circular median. |
None
|
alpha
|
Optional[ndarray]
|
Data in radian. |
None
|
w
|
Optional[ndarray]
|
Frequencies or weights |
None
|
Returns:
| Type | Description |
|---|---|
lower, upper, ci: tuple
|
confidence intervals and alpha-level. For |
Note
Implementation of section 4.4.2 (Fisher,1993)
Source code in pycircstat2/descriptive.py
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | |
circ_kappa(r, n=None)
Estimate kappa by approximation.
For \(n \le 15\):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
Resultant vector length |
required |
n
|
Union[int, None]
|
Sample size. If n is not None, the adjustment for small sample size will be applied. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
kappa |
float
|
Concentration parameter |
Reference
Section 4.5.5 (P88, Fisher, 1993)
Source code in pycircstat2/descriptive.py
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 | |
circ_dist(x, y=None, metric='center', return_sum=False)
Compute the element-wise circular distance between two arrays of angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array - like
|
First sample of circular data (radians). |
required |
y
|
array - like
|
Second sample of circular data (radians). If None, computes element-wise
distances within |
None
|
metric
|
str
|
Distance metric to use, options: - "center" (default): Standard circular difference wrapped to [-π, π]. - "geodesic": π - |π - |x - y||. - "angularseparation": 1 - cos(x - y). - "chord": sqrt(2 * (1 - cos(x - y))). |
'center'
|
return_sum
|
bool
|
If True, returns the sum of all computed distances (like R's |
False
|
Returns:
| Type | Description |
|---|---|
array
|
Element-wise distance values based on the chosen metric. |
Source code in pycircstat2/descriptive.py
1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 | |
circ_pairdist(x, y=None, metric='center', return_sum=False)
Compute the pairwise circular distance between all elements in x and y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array - like
|
First sample of circular data (radians). |
required |
y
|
array - like
|
Second sample of circular data (radians). If None, computes pairwise
distances within |
None
|
metric
|
str
|
Distance metric to use (same options as |
'center'
|
return_sum
|
bool
|
If True, returns the sum of all computed distances (like R's |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Pairwise distance matrix where entry (i, j) is the circular distance between x[i] and y[j] based on the chosen metric. |
Source code in pycircstat2/descriptive.py
1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 | |
convert_moment(mp)
Convert complex moment to polar coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mp
|
complex
|
Complex moment |
required |
Returns:
| Name | Type | Description |
|---|---|---|
u |
float
|
Angle in radian |
r |
float
|
Magnitude |
Source code in pycircstat2/descriptive.py
1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 | |
compute_C_and_S(alpha, w, p=1, mean=0.0)
Compute the intermediate values Cbar and Sbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian. |
required |
w
|
ndarray
|
Frequencies or weights. |
required |
p
|
int
|
Order of the moment (default is 1, for the first moment). |
1
|
mean
|
Union[float, ndarray]
|
Mean angle (μ) to center the computation (default is 0.0). |
0.0
|
Returns:
| Name | Type | Description |
|---|---|---|
Cbar |
float
|
Weighted mean cosine for the given moment. |
Sbar |
float
|
Weighted mean sine for the given moment. |
Source code in pycircstat2/descriptive.py
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | |
compute_hdi(samples, ci=0.95)
Compute the Highest Density Interval (HDI) for circular data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples
|
ndarray
|
Bootstrap samples of the circular mean in radians. |
required |
ci
|
float
|
Credible interval (default is 0.95 for 95% HDI). |
0.95
|
Returns:
| Name | Type | Description |
|---|---|---|
hdi |
tuple
|
Lower and upper bounds of the HDI in radians. |
Source code in pycircstat2/descriptive.py
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 | |
compute_smooth_params(r, n)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float
|
resultant vector length |
required |
n
|
int
|
sample size |
required |
Returns:
| Name | Type | Description |
|---|---|---|
h |
float
|
smoothing parameter |
Reference
Section 2.2 (P26, Fisher, 1993)
Source code in pycircstat2/descriptive.py
1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 | |
nonparametric_density_estimation(alpha, h, radius=1, n_grid=100)
Nonparametric density estimates with a quartic kernel function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radian |
required |
h
|
float
|
Smoothing parameters |
required |
radius
|
float
|
radius of the plotted circle |
1
|
n_grid
|
int
|
Number of grid points on |
100
|
Returns:
| Name | Type | Description |
|---|---|---|
x |
ndarray(n_grid)
|
grid |
f |
ndarray(n_grid)
|
density |
Reference
Section 2.2 (P26, Fisher, 1993)
Source code in pycircstat2/descriptive.py
1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | |
circ_range(alpha)
Compute the circular range of angular data.
The circular range is 2π minus the largest gap between consecutive
sorted angles — equivalently, the angular extent of the smallest arc
containing every observation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Angles in radians. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Circular range in radians, in |
Reference
P162, Section 7.2.3 of Jammalamadaka, S. Rao and SenGupta, A. (2001)
Source code in pycircstat2/descriptive.py
1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 | |
circ_quantile(alpha, probs=np.array([0, 0.25, 0.5, 0.75, 1.0]), type=7)
Compute quantiles for circular data.
This function computes quantiles for circular data by shifting the data to be centered around the circular median, applying a linear quantile function, and then shifting back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
ndarray
|
Sample of circular data (radians). |
required |
probs
|
float or ndarray
|
Probabilities at which to compute quantiles. Default is |
array([0, 0.25, 0.5, 0.75, 1.0])
|
type
|
int
|
Quantile algorithm in the Hyndman & Fan (1996) sense, matching R's
|
7
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Circular quantiles. |
References
- R's
quantile.circularfrom thecircularpackage. - Fisher (1993), Section 2.3.2.
- Hyndman, R. J. & Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician, 50, 361–365.
Source code in pycircstat2/descriptive.py
1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 | |