/usr/share/doc/maxima-sage-doc/html/maxima_77.html is in maxima-sage-doc 5.35.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 58 59 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 110 111 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 151 152 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 208 209 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 255 256 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 297 298 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 333 334 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 369 370 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 404 405 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 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 496 497 498 499 500 501 502 503 504 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 543 544 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 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 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 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 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 920 921 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 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 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 1482 1483 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 1548 1549 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 1612 1613 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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on December, 5 2016 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>Maxima 5.35.1 Manual: 77. stats</title>
<meta name="description" content="Maxima 5.35.1 Manual: 77. stats">
<meta name="keywords" content="Maxima 5.35.1 Manual: 77. stats">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body {color: black; background: white; margin-left: 8%; margin-right: 13%;
font-family: "FreeSans", sans-serif}
h1 {font-size: 150%; font-family: "FreeSans", sans-serif}
h2 {font-size: 125%; font-family: "FreeSans", sans-serif}
h3 {font-size: 100%; font-family: "FreeSans", sans-serif}
a[href] {color: rgb(0,0,255); text-decoration: none;}
a[href]:hover {background: rgb(220,220,220);}
div.textbox {border: solid; border-width: thin; padding-top: 1em;
padding-bottom: 1em; padding-left: 2em; padding-right: 2em}
div.titlebox {border: none; padding-top: 1em; padding-bottom: 1em;
padding-left: 2em; padding-right: 2em; background: rgb(200,255,255);
font-family: sans-serif}
div.synopsisbox {
border: none; padding-top: 1em; padding-bottom: 1em; padding-left: 2em;
padding-right: 2em; background: rgb(255,220,255);}
pre.example {border: 1px solid rgb(180,180,180); padding-top: 1em;
padding-bottom: 1em; padding-left: 1em; padding-right: 1em;
background-color: rgb(238,238,255)}
div.spacerbox {border: none; padding-top: 2em; padding-bottom: 2em}
div.image {margin: 0; padding: 1em; text-align: center}
div.categorybox {border: 1px solid gray; padding-top: 0px; padding-bottom: 0px;
padding-left: 1em; padding-right: 1em; background: rgb(247,242,220)}
-->
</style>
<link rel="icon" href="figures/favicon.ico"/>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="stats"></a>
<a name="SEC367"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_76.html#SEC366" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC368" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_76.html#SEC364" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_83.html#SEC392" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 77. stats </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC368">77.1 Introduction to stats</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC369">77.2 Functions and Variables for inference_result</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC370">77.3 Functions and Variables for stats</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC371">77.4 Functions and Variables for special distributions</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p><a name="Item_003a-Introduction-to-stats"></a>
</p><hr size="6">
<a name="Introduction-to-stats"></a>
<a name="SEC368"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC367" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC369" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC367" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC367" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_83.html#SEC392" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.1 Introduction to stats </h2>
<p>Package <code>stats</code> contains a set of classical statistical inference and
hypothesis testing procedures.
</p>
<p>All these functions return an <code>inference_result</code> Maxima object which contains
the necessary results for population inferences and decision making.
</p>
<p>Global variable <code>stats_numer</code> controls whether results are given in
floating point or symbolic and rational format; its default value is <code>true</code>
and results are returned in floating point format.
</p>
<p>Package <code>descriptive</code> contains some utilities to manipulate data structures
(lists and matrices); for example, to extract subsamples. It also contains some
examples on how to use package <code>numericalio</code> to read data from plain text
files. See <code>descriptive</code> and <code>numericalio</code> for more details.
</p>
<p>Package <code>stats</code> loads packages <code>descriptive</code>, <code>distrib</code> and
<code>inference_result</code>.
</p>
<p>For comments, bugs or suggestions, please contact the author at
</p>
<p><var>'mario AT edu DOT xunta DOT es'</var>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Statistical inference} ·
@ref{Category: Share packages} ·
@ref{Category: Package stats}
</div>
</p>
<p><a name="Item_003a-Functions-and-Variables-for-inference_005fresult"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-inference_005fresult"></a>
<a name="SEC369"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC368" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC370" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC367" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC367" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_83.html#SEC392" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.2 Functions and Variables for inference_result </h2>
<p><a name="Item_003a-inference_005fresult"></a>
</p><dl>
<dt><u>Function:</u> <b>inference_result</b><i> (<var>title</var>, <var>values</var>, <var>numbers</var>)</i>
<a name="IDX2364"></a>
</dt>
<dd><p>Constructs an <code>inference_result</code> object of the type returned by the
stats functions. Argument <var>title</var> is a
string with the name of the procedure; <var>values</var> is a list with
elements of the form <code>symbol = value</code> and <var>numbers</var> is a list
with positive integer numbers ranging from one to <code>length(<var>values</var>)</code>,
indicating which values will be shown by default.
</p>
<p>Example:
</p>
<p>This is a simple example showing results concerning a rectangle. The title of
this object is the string <code>"Rectangle"</code>, it stores five results, named
<code>'base</code>, <code>'height</code>, <code>'diagonal</code>, <code>'area</code>,
and <code>'perimeter</code>, but only the first, second, fifth, and fourth
will be displayed. The <code>'diagonal</code> is stored in this object, but it is
not displayed; to access its value, make use of function <code>take_inference</code>.
</p>
<pre class="example">(%i1) load(inference_result)$
(%i2) b: 3$ h: 2$
(%i3) inference_result("Rectangle",
['base=b,
'height=h,
'diagonal=sqrt(b^2+h^2),
'area=b*h,
'perimeter=2*(b+h)],
[1,2,5,4] );
| Rectangle
|
| base = 3
|
(%o3) | height = 2
|
| perimeter = 10
|
| area = 6
(%i4) take_inference('diagonal,%);
(%o4) sqrt(13)
</pre>
<p>See also <code>take_inference</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-inferencep"></a>
</p><dl>
<dt><u>Function:</u> <b>inferencep</b><i> (<var>obj</var>)</i>
<a name="IDX2365"></a>
</dt>
<dd><p>Returns <code>true</code> or <code>false</code>, depending on whether <var>obj</var> is an
<code>inference_result</code> object or not.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-items_005finference"></a>
</p><dl>
<dt><u>Function:</u> <b>items_inference</b><i> (<var>obj</var>)</i>
<a name="IDX2366"></a>
</dt>
<dd><p>Returns a list with the names of the items stored in <var>obj</var>, which must
be an <code>inference_result</code> object.
</p>
<p>Example:
</p>
<p>The <code>inference_result</code> object stores two values, named <code>'pi</code> and <code>'e</code>,
but only the second is displayed. The <code>items_inference</code> function returns the names
of all items, no matter they are displayed or not.
</p>
<pre class="example">(%i1) load(inference_result)$
(%i2) inference_result("Hi", ['pi=%pi,'e=%e],[2]);
| Hi
(%o2) |
| e = %e
(%i3) items_inference(%);
(%o3) [pi, e]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-take_005finference"></a>
</p><dl>
<dt><u>Function:</u> <b>take_inference</b><i> <br> <tt>take_inference</tt> (<var>n</var>, <var>obj</var>) <br> <tt>take_inference</tt> (<var>name</var>, <var>obj</var>) <br> <tt>take_inference</tt> (<var>list</var>, <var>obj</var>)</i>
<a name="IDX2367"></a>
</dt>
<dd><p>Returns the <var>n</var>-th value stored in <var>obj</var> if <var>n</var> is a positive integer,
or the item named <var>name</var> if this is the name of an item. If the first
argument is a list of numbers and/or symbols, function <code>take_inference</code> returns
a list with the corresponding results.
</p>
<p>Example:
</p>
<p>Given an <code>inference_result</code> object, function <code>take_inference</code> is
called in order to extract some information stored in it.
</p>
<pre class="example">(%i1) load(inference_result)$
(%i2) b: 3$ h: 2$
(%i3) sol: inference_result("Rectangle",
['base=b,
'height=h,
'diagonal=sqrt(b^2+h^2),
'area=b*h,
'perimeter=2*(b+h)],
[1,2,5,4] );
| Rectangle
|
| base = 3
|
(%o3) | height = 2
|
| perimeter = 10
|
| area = 6
(%i4) take_inference('base,sol);
(%o4) 3
(%i5) take_inference(5,sol);
(%o5) 10
(%i6) take_inference([1,'diagonal],sol);
(%o6) [3, sqrt(13)]
(%i7) take_inference(items_inference(sol),sol);
(%o7) [3, 2, sqrt(13), 6, 10]
</pre>
<p>See also <code>inference_result</code> and <code>take_inference</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-Functions-and-Variables-for-stats"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-stats"></a>
<a name="SEC370"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC369" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC371" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC367" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC367" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_83.html#SEC392" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.3 Functions and Variables for stats </h2>
<p><a name="Item_003a-stats_005fnumer"></a>
</p><dl>
<dt><u>Option variable:</u> <b>stats_numer</b>
<a name="IDX2368"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>If <code>stats_numer</code> is <code>true</code>, inference statistical functions
return their results in floating point numbers. If it is <code>false</code>,
results are given in symbolic and rational format.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats} ·
@ref{Category: Numerical evaluation}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fmean"></a>
</p><dl>
<dt><u>Function:</u> <b>test_mean</b><i> <br> <tt>test_mean</tt> (<var>x</var>) <br> <tt>test_mean</tt> (<var>x</var>, <var>options</var> ...)</i>
<a name="IDX2369"></a>
</dt>
<dd><p>This is the mean <var>t</var>-test. Argument <var>x</var> is a list or a column matrix
containing a one dimensional sample. It also performs an asymptotic test
based on the <i>Central Limit Theorem</i> if option <code>'asymptotic</code> is
<code>true</code>.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'mean</code>, default <code>0</code>, is the mean value to be checked.
</li><li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li><li>
<code>'dev</code>, default <code>'unknown</code>, this is the value of the standard deviation when it is
known; valid values are: <code>'unknown</code> or a positive expression.
</li><li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the confidence interval; it must
be an expression which takes a value in (0,1).
</li><li>
<code>'asymptotic</code>, default <code>false</code>, indicates whether it performs an exact <var>t</var>-test or
an asymptotic one based on the <i>Central Limit Theorem</i>;
valid values are <code>true</code> and <code>false</code>.
</li></ul>
<p>The output of function <code>test_mean</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'mean_estimate</code>: the sample mean.
</li><li>
<code>'conf_level</code>: confidence level selected by the user.
</li><li>
<code>'conf_interval</code>: confidence interval for the population mean.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameter(s).
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>Performs an exact <var>t</var>-test with unknown variance. The null hypothesis
is <em>H_0: mean=50</em> against the one sided alternative <em>H_1: mean<50</em>;
according to the results, the <em>p</em>-value is too great, there are no
evidence for rejecting <em>H_0</em>.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) data: [78,64,35,45,45,75,43,74,42,42]$
(%i3) test_mean(data,'conflevel=0.9,'alternative='less,'mean=50);
| MEAN TEST
|
| mean_estimate = 54.3
|
| conf_level = 0.9
|
| conf_interval = [minf, 61.51314273502712]
|
(%o3) | method = Exact t-test. Unknown variance.
|
| hypotheses = H0: mean = 50 , H1: mean < 50
|
| statistic = .8244705235071678
|
| distribution = [student_t, 9]
|
| p_value = .7845100411786889
</pre>
<p>This time Maxima performs an asymptotic test, based on the <i>Central Limit Theorem</i>.
The null hypothesis is <em>H_0: equal(mean, 50)</em> against the two sided alternative <em>H_1: not equal(mean, 50)</em>;
according to the results, the <em>p</em>-value is very small, <em>H_0</em> should be rejected in
favor of the alternative <em>H_1</em>. Note that, as indicated by the <code>Method</code> component,
this procedure should be applied to large samples.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) test_mean([36,118,52,87,35,256,56,178,57,57,89,34,25,98,35,
98,41,45,198,54,79,63,35,45,44,75,42,75,45,45,
45,51,123,54,151],
'asymptotic=true,'mean=50);
| MEAN TEST
|
| mean_estimate = 74.88571428571429
|
| conf_level = 0.95
|
| conf_interval = [57.72848600856194, 92.04294256286663]
|
(%o2) | method = Large sample z-test. Unknown variance.
|
| hypotheses = H0: mean = 50 , H1: mean # 50
|
| statistic = 2.842831192874313
|
| distribution = [normal, 0, 1]
|
| p_value = .004471474652002261
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fmeans_005fdifference"></a>
</p><dl>
<dt><u>Function:</u> <b>test_means_difference</b><i> <br> <tt>test_means_difference</tt> (<var>x1</var>, <var>x2</var>) <br> <tt>test_means_difference</tt> (<var>x1</var>, <var>x2</var>, <var>options</var> ...)</i>
<a name="IDX2370"></a>
</dt>
<dd><p>This is the difference of means <var>t</var>-test for two samples.
Arguments <var>x1</var> and <var>x2</var> are lists or column matrices
containing two independent samples. In case of different unknown variances
(see options <code>'dev1</code>, <code>'dev2</code> and <code>'varequal</code> bellow),
the degrees of freedom are computed by means of the Welch approximation.
It also performs an asymptotic test
based on the <i>Central Limit Theorem</i> if option <code>'asymptotic</code> is
set to <code>true</code>.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li><li>
<code>'dev1</code>, default <code>'unknown</code>, this is the value of the standard deviation
of the <var>x1</var> sample when it is known; valid values are: <code>'unknown</code> or a positive expression.
</li><li>
<code>'dev2</code>, default <code>'unknown</code>, this is the value of the standard deviation
of the <var>x2</var> sample when it is known; valid values are: <code>'unknown</code> or a positive expression.
</li><li>
<code>'varequal</code>, default <code>false</code>, whether variances should be considered to be equal or not;
this option takes effect only when <code>'dev1</code> and/or <code>'dev2</code> are <code>'unknown</code>.
</li><li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the confidence interval; it must
be an expression which takes a value in (0,1).
</li><li>
<code>'asymptotic</code>, default <code>false</code>, indicates whether it performs an exact <var>t</var>-test or
an asymptotic one based on the <i>Central Limit Theorem</i>;
valid values are <code>true</code> and <code>false</code>.
</li></ul>
<p>The output of function <code>test_means_difference</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'diff_estimate</code>: the difference of means estimate.
</li><li>
<code>'conf_level</code>: confidence level selected by the user.
</li><li>
<code>'conf_interval</code>: confidence interval for the difference of means.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameter(s).
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>The equality of means is tested with two small samples <var>x</var> and <var>y</var>,
against the alternative <em>H_1: m_1>m_2</em>, being <em>m_1</em> and <em>m_2</em>
the populations means; variances are unknown and supposed to be different.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [20.4,62.5,61.3,44.2,11.1,23.7]$
(%i3) y: [1.2,6.9,38.7,20.4,17.2]$
(%i4) test_means_difference(x,y,'alternative='greater);
| DIFFERENCE OF MEANS TEST
|
| diff_estimate = 20.31999999999999
|
| conf_level = 0.95
|
| conf_interval = [- .04597417812882298, inf]
|
(%o4) | method = Exact t-test. Welch approx.
|
| hypotheses = H0: mean1 = mean2 , H1: mean1 > mean2
|
| statistic = 1.838004300728477
|
| distribution = [student_t, 8.62758740184604]
|
| p_value = .05032746527991905
</pre>
<p>The same test as before, but now variances are supposed to be
equal.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [20.4,62.5,61.3,44.2,11.1,23.7]$
(%i3) y: matrix([1.2],[6.9],[38.7],[20.4],[17.2])$
(%i4) test_means_difference(x,y,'alternative='greater,
'varequal=true);
| DIFFERENCE OF MEANS TEST
|
| diff_estimate = 20.31999999999999
|
| conf_level = 0.95
|
| conf_interval = [- .7722627696897568, inf]
|
(%o4) | method = Exact t-test. Unknown equal variances
|
| hypotheses = H0: mean1 = mean2 , H1: mean1 > mean2
|
| statistic = 1.765996124515009
|
| distribution = [student_t, 9]
|
| p_value = .05560320992529344
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fvariance"></a>
</p><dl>
<dt><u>Function:</u> <b>test_variance</b><i> <br> <tt>test_variance</tt> (<var>x</var>) <br> <tt>test_variance</tt> (<var>x</var>, <var>options</var>, ...)</i>
<a name="IDX2371"></a>
</dt>
<dd><p>This is the variance <var>chi^2</var>-test. Argument <var>x</var> is a list or a column matrix
containing a one dimensional sample taken from a normal population.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'mean</code>, default <code>'unknown</code>, is the population's mean, when it is known.
</li><li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li><li>
<code>'variance</code>, default <code>1</code>, this is the variance value (positive) to be checked.
</li><li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the confidence interval; it must
be an expression which takes a value in (0,1).
</li></ul>
<p>The output of function <code>test_variance</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'var_estimate</code>: the sample variance.
</li><li>
<code>'conf_level</code>: confidence level selected by the user.
</li><li>
<code>'conf_interval</code>: confidence interval for the population variance.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameter.
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>It is tested whether the variance of a population with unknown mean
is equal to or greater than 200.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [203,229,215,220,223,233,208,228,209]$
(%i3) test_variance(x,'alternative='greater,'variance=200);
| VARIANCE TEST
|
| var_estimate = 110.75
|
| conf_level = 0.95
|
| conf_interval = [57.13433376937479, inf]
|
(%o3) | method = Variance Chi-square test. Unknown mean.
|
| hypotheses = H0: var = 200 , H1: var > 200
|
| statistic = 4.43
|
| distribution = [chi2, 8]
|
| p_value = .8163948512777689
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fvariance_005fratio"></a>
</p><dl>
<dt><u>Function:</u> <b>test_variance_ratio</b><i> <br> <tt>test_variance_ratio</tt> (<var>x1</var>, <var>x2</var>) <br> <tt>test_variance_ratio</tt> (<var>x1</var>, <var>x2</var>, <var>options</var> ...)</i>
<a name="IDX2372"></a>
</dt>
<dd><p>This is the variance ratio <var>F</var>-test for two normal populations.
Arguments <var>x1</var> and <var>x2</var> are lists or column matrices
containing two independent samples.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li><li>
<code>'mean1</code>, default <code>'unknown</code>, when it is known, this is the mean of
the population from which <var>x1</var> was taken.
</li><li>
<code>'mean2</code>, default <code>'unknown</code>, when it is known, this is the mean of
the population from which <var>x2</var> was taken.
</li><li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the confidence interval of the
ratio; it must be an expression which takes a value in (0,1).
</li></ul>
<p>The output of function <code>test_variance_ratio</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'ratio_estimate</code>: the sample variance ratio.
</li><li>
<code>'conf_level</code>: confidence level selected by the user.
</li><li>
<code>'conf_interval</code>: confidence interval for the variance ratio.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameters.
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>The equality of the variances of two normal populations is checked
against the alternative that the first is greater than the second.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [20.4,62.5,61.3,44.2,11.1,23.7]$
(%i3) y: [1.2,6.9,38.7,20.4,17.2]$
(%i4) test_variance_ratio(x,y,'alternative='greater);
| VARIANCE RATIO TEST
|
| ratio_estimate = 2.316933391522034
|
| conf_level = 0.95
|
| conf_interval = [.3703504689507268, inf]
|
(%o4) | method = Variance ratio F-test. Unknown means.
|
| hypotheses = H0: var1 = var2 , H1: var1 > var2
|
| statistic = 2.316933391522034
|
| distribution = [f, 5, 4]
|
| p_value = .2179269692254457
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fproportion"></a>
</p><dl>
<dt><u>Function:</u> <b>test_proportion</b><i> <br> <tt>test_proportion</tt> (<var>x</var>, <var>n</var>) <br> <tt>test_proportion</tt> (<var>x</var>, <var>n</var>, <var>options</var> ...)</i>
<a name="IDX2373"></a>
</dt>
<dd><p>Inferences on a proportion. Argument <var>x</var> is the number of successes
in <var>n</var> trials in a Bernoulli experiment with unknown probability.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'proportion</code>, default <code>1/2</code>, is the value of the proportion to be checked.
</li><li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li><li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the confidence interval; it must
be an expression which takes a value in (0,1).
</li><li>
<code>'asymptotic</code>, default <code>false</code>, indicates whether it performs an exact test
based on the binomial distribution, or an asymptotic one based on the <i>Central Limit Theorem</i>;
valid values are <code>true</code> and <code>false</code>.
</li><li>
<code>'correct</code>, default <code>true</code>, indicates whether Yates correction is applied or not.
</li></ul>
<p>The output of function <code>test_proportion</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'sample_proportion</code>: the sample proportion.
</li><li>
<code>'conf_level</code>: confidence level selected by the user.
</li><li>
<code>'conf_interval</code>: Wilson confidence interval for the proportion.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameters.
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>Performs an exact test. The null hypothesis
is <em>H_0: p=1/2</em> against the one sided alternative <em>H_1: p<1/2</em>.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) test_proportion(45, 103, alternative = less);
| PROPORTION TEST
|
| sample_proportion = .4368932038834951
|
| conf_level = 0.95
|
| conf_interval = [0, 0.522714149150231]
|
(%o2) | method = Exact binomial test.
|
| hypotheses = H0: p = 0.5 , H1: p < 0.5
|
| statistic = 45
|
| distribution = [binomial, 103, 0.5]
|
| p_value = .1184509388901454
</pre>
<p>A two sided asymptotic test. Confidence level is 99/100.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) fpprintprec:7$
(%i3) test_proportion(45, 103,
conflevel = 99/100, asymptotic=true);
| PROPORTION TEST
|
| sample_proportion = .43689
|
| conf_level = 0.99
|
| conf_interval = [.31422, .56749]
|
(%o3) | method = Asympthotic test with Yates correction.
|
| hypotheses = H0: p = 0.5 , H1: p # 0.5
|
| statistic = .43689
|
| distribution = [normal, 0.5, .048872]
|
| p_value = .19662
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fproportions_005fdifference"></a>
</p><dl>
<dt><u>Function:</u> <b>test_proportions_difference</b><i> <br> <tt>test_proportions_difference</tt> (<var>x1</var>, <var>n1</var>, <var>x2</var>, <var>n2</var>) <br> <tt>test_proportions_difference</tt> (<var>x1</var>, <var>n1</var>, <var>x2</var>, <var>n2</var>, <var>options</var> …)</i>
<a name="IDX2374"></a>
</dt>
<dd><p>Inferences on the difference of two proportions. Argument <var>x1</var> is the number of successes
in <var>n1</var> trials in a Bernoulli experiment in the first population, and <var>x2</var> and <var>n2</var>
are the corresponding values in the second population. Samples are independent and the test
is asymptotic.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code> (<code>p1 # p2</code>), <code>'greater</code> (<code>p1 > p2</code>)
and <code>'less</code> (<code>p1 < p2</code>).
</li><li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the confidence interval; it must
be an expression which takes a value in (0,1).
</li><li>
<code>'correct</code>, default <code>true</code>, indicates whether Yates correction is applied or not.
</li></ul>
<p>The output of function <code>test_proportions_difference</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'proportions</code>: list with the two sample proportions.
</li><li>
<code>'conf_level</code>: confidence level selected by the user.
</li><li>
<code>'conf_interval</code>: Confidence interval for the difference of proportions <code>p1 - p2</code>.
</li><li>
<code>'method</code>: inference procedure and warning message in case of any of the samples sizes
is less than 10.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameters.
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>A machine produced 10 defective articles in a batch of 250.
After some maintenance work, it produces 4 defective in a batch of 150.
In order to know if the machine has improved, we test the null
hypothesis <code>H0:p1=p2</code>, against the alternative <code>H0:p1>p2</code>,
where <code>p1</code> and <code>p2</code> are the probabilities for one produced
article to be defective before and after maintenance. According to
the p value, there is not enough evidence to accept the alternative.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) fpprintprec:7$
(%i3) test_proportions_difference(10, 250, 4, 150,
alternative = greater);
| DIFFERENCE OF PROPORTIONS TEST
|
| proportions = [0.04, .02666667]
|
| conf_level = 0.95
|
| conf_interval = [- .02172761, 1]
|
(%o3) | method = Asymptotic test. Yates correction.
|
| hypotheses = H0: p1 = p2 , H1: p1 > p2
|
| statistic = .01333333
|
| distribution = [normal, 0, .01898069]
|
| p_value = .2411936
</pre>
<p>Exact standard deviation of the asymptotic normal
distribution when the data are unknown.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) stats_numer: false$
(%i3) sol: test_proportions_difference(x1,n1,x2,n2)$
(%i4) last(take_inference('distribution,sol));
1 1 x2 + x1
(-- + --) (x2 + x1) (1 - -------)
n2 n1 n2 + n1
(%o4) sqrt(---------------------------------)
n2 + n1
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fsign"></a>
</p><dl>
<dt><u>Function:</u> <b>test_sign</b><i> <br> <tt>test_sign</tt> (<var>x</var>) <br> <tt>test_sign</tt> (<var>x</var>, <var>options</var> …)</i>
<a name="IDX2375"></a>
</dt>
<dd><p>This is the non parametric sign test for the median of a continuous population.
Argument <var>x</var> is a list or a column matrix containing a one dimensional sample.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li><li>
<code>'median</code>, default <code>0</code>, is the median value to be checked.
</li></ul>
<p>The output of function <code>test_sign</code> is an <code>inference_result</code> Maxima object
showing the following results:
</p>
<ol>
<li>
<code>'med_estimate</code>: the sample median.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameter(s).
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>Checks whether the population from which the sample was taken has median 6,
against the alternative <em>H_1: median > 6</em>.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [2,0.1,7,1.8,4,2.3,5.6,7.4,5.1,6.1,6]$
(%i3) test_sign(x,'median=6,'alternative='greater);
| SIGN TEST
|
| med_estimate = 5.1
|
| method = Non parametric sign test.
|
(%o3) | hypotheses = H0: median = 6 , H1: median > 6
|
| statistic = 7
|
| distribution = [binomial, 10, 0.5]
|
| p_value = .05468749999999989
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fsigned_005frank"></a>
</p><dl>
<dt><u>Function:</u> <b>test_signed_rank</b><i> <br> <tt>test_signed_rank</tt> (<var>x</var>) <br> <tt>test_signed_rank</tt> (<var>x</var>, <var>options</var> …)</i>
<a name="IDX2376"></a>
</dt>
<dd><p>This is the Wilcoxon signed rank test to make inferences about the median of a
continuous population. Argument <var>x</var> is a list or a column matrix
containing a one dimensional sample. Performs normal approximation if the
sample size is greater than 20, or if there are zeroes or ties.
</p>
<p>See also <code>pdf_rank_test</code> and <code>cdf_rank_test</code>.
</p>
<p>Options:
</p>
<ul>
<li>
<code>'median</code>, default <code>0</code>, is the median value to be checked.
</li><li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li></ul>
<p>The output of function <code>test_signed_rank</code> is an <code>inference_result</code> Maxima object
with the following results:
</p>
<ol>
<li>
<code>'med_estimate</code>: the sample median.
</li><li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameter(s).
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>Checks the null hypothesis <em>H_0: median = 15</em> against the
alternative <em>H_1: median > 15</em>. This is an exact test, since
there are no ties.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [17.1,15.9,13.7,13.4,15.5,17.6]$
(%i3) test_signed_rank(x,median=15,alternative=greater);
| SIGNED RANK TEST
|
| med_estimate = 15.7
|
| method = Exact test
|
(%o3) | hypotheses = H0: med = 15 , H1: med > 15
|
| statistic = 14
|
| distribution = [signed_rank, 6]
|
| p_value = 0.28125
</pre>
<p>Checks the null hypothesis <em>H_0: equal(median, 2.5)</em> against the
alternative <em>H_1: not equal(median, 2.5)</em>. This is an approximated test,
since there are ties.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) y:[1.9,2.3,2.6,1.9,1.6,3.3,4.2,4,2.4,2.9,1.5,3,2.9,4.2,3.1]$
(%i3) test_signed_rank(y,median=2.5);
| SIGNED RANK TEST
|
| med_estimate = 2.9
|
| method = Asymptotic test. Ties
|
(%o3) | hypotheses = H0: med = 2.5 , H1: med # 2.5
|
| statistic = 76.5
|
| distribution = [normal, 60.5, 17.58195097251724]
|
| p_value = .3628097734643669
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005frank_005fsum"></a>
</p><dl>
<dt><u>Function:</u> <b>test_rank_sum</b><i> <br> <tt>test_rank_sum</tt> (<var>x1</var>, <var>x2</var>) <br> <tt>test_rank_sum</tt> (<var>x1</var>, <var>x2</var>, <var>option</var>)</i>
<a name="IDX2377"></a>
</dt>
<dd><p>This is the Wilcoxon-Mann-Whitney test for comparing the medians of two
continuous populations. The first two arguments <var>x1</var> and <var>x2</var> are lists
or column matrices with the data of two independent samples. Performs normal
approximation if any of the sample sizes is greater than 10, or if there are ties.
</p>
<p>Option:
</p>
<ul>
<li>
<code>'alternative</code>, default <code>'twosided</code>, is the alternative hypothesis;
valid values are: <code>'twosided</code>, <code>'greater</code> and <code>'less</code>.
</li></ul>
<p>The output of function <code>test_rank_sum</code> is an <code>inference_result</code> Maxima object
with the following results:
</p>
<ol>
<li>
<code>'method</code>: inference procedure.
</li><li>
<code>'hypotheses</code>: null and alternative hypotheses to be tested.
</li><li>
<code>'statistic</code>: value of the sample statistic used for testing the null hypothesis.
</li><li>
<code>'distribution</code>: distribution of the sample statistic, together with its parameters.
</li><li>
<code>'p_value</code>: <em>p</em>-value of the test.
</li></ol>
<p>Examples:
</p>
<p>Checks whether populations have similar medians. Samples sizes
are small and an exact test is made.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x:[12,15,17,38,42,10,23,35,28]$
(%i3) y:[21,18,25,14,52,65,40,43]$
(%i4) test_rank_sum(x,y);
| RANK SUM TEST
|
| method = Exact test
|
| hypotheses = H0: med1 = med2 , H1: med1 # med2
(%o4) |
| statistic = 22
|
| distribution = [rank_sum, 9, 8]
|
| p_value = .1995886466474702
</pre>
<p>Now, with greater samples and ties, the procedure makes
normal approximation. The alternative hypothesis is
<em>H_1: median1 < median2</em>.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x: [39,42,35,13,10,23,15,20,17,27]$
(%i3) y: [20,52,66,19,41,32,44,25,14,39,43,35,19,56,27,15]$
(%i4) test_rank_sum(x,y,'alternative='less);
| RANK SUM TEST
|
| method = Asymptotic test. Ties
|
| hypotheses = H0: med1 = med2 , H1: med1 < med2
(%o4) |
| statistic = 48.5
|
| distribution = [normal, 79.5, 18.95419580097078]
|
| p_value = .05096985666598441
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-test_005fnormality"></a>
</p><dl>
<dt><u>Function:</u> <b>test_normality</b><i> (<var>x</var>)</i>
<a name="IDX2378"></a>
</dt>
<dd><p>Shapiro-Wilk test for normality. Argument <var>x</var> is a list of numbers, and sample
size must be greater than 2 and less or equal than 5000, otherwise, function
<code>test_normality</code> signals an error message.
</p>
<p>Reference:
</p>
<p> [1] Algorithm AS R94, Applied Statistics (1995), vol.44, no.4, 547-551
</p>
<p>The output of function <code>test_normality</code> is an <code>inference_result</code> Maxima object
with the following results:
</p>
<ol>
<li>
<code>'statistic</code>: value of the <var>W</var> statistic.
</li><li>
<code>'p_value</code>: <em>p</em>-value under normal assumption.
</li></ol>
<p>Examples:
</p>
<p>Checks for the normality of a population, based on a sample of size 9.
</p>
<pre class="example">(%i1) load("stats")$
(%i2) x:[12,15,17,38,42,10,23,35,28]$
(%i3) test_normality(x);
| SHAPIRO - WILK TEST
|
(%o3) | statistic = .9251055695162436
|
| p_value = .4361763918860381
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-linear_005fregression"></a>
</p><dl>
<dt><u>Function:</u> <b>linear_regression</b><i> <br> <tt>linear_regression</tt> (<var>x</var>) <br> <tt>linear_regression</tt> (<var>x</var> <var>option</var>)</i>
<a name="IDX2379"></a>
</dt>
<dd><p>Multivariate linear regression,
<em>y_i = b0 + b1*x_1i + b2*x_2i + ... + bk*x_ki + u_i</em>,
where <em>u_i</em> are <em>N(0,sigma)</em> independent random variables.
Argument <var>x</var> must be a matrix with more than one column. The
last column is considered as the responses (<em>y_i</em>).
</p>
<p>Option:
</p>
<ul>
<li>
<code>'conflevel</code>, default <code>95/100</code>, confidence level for the
confidence intervals; it must be an expression which takes a value
in (0,1).
</li></ul>
<p>The output of function <code>linear_regression</code> is an
<code>inference_result</code> Maxima object with the following results:
</p>
<ol>
<li>
<code>'b_estimation</code>: regression coefficients estimates.
</li><li>
<code>'b_covariances</code>: covariance matrix of the regression
coefficients estimates.
</li><li>
<code>b_conf_int</code>: confidence intervals of the regression coefficients.
</li><li>
<code>b_statistics</code>: statistics for testing coefficient.
</li><li>
<code>b_p_values</code>: p-values for coefficient tests.
</li><li>
<code>b_distribution</code>: probability distribution for coefficient tests.
</li><li>
<code>v_estimation</code>: unbiased variance estimator.
</li><li>
<code>v_conf_int</code>: variance confidence interval.
</li><li>
<code>v_distribution</code>: probability distribution for variance test.
</li><li>
<code>residuals</code>: residuals.
</li><li>
<code>adc</code>: adjusted determination coefficient.
</li><li>
<code>aic</code>: Akaike's information criterion.
</li><li>
<code>bic</code>: Bayes's information criterion.
</li></ol>
<p>Only items 1, 4, 5, 6, 7, 8, 9 and 11 above, in this order,
are shown by default. The rest remain hidden until the user
makes use of functions <code>items_inference</code> and <code>take_inference</code>.
</p>
<p>Example:
</p>
<p>Fitting a linear model to a trivariate sample. The
last column is considered as the responses (<em>y_i</em>).
</p>
<pre class="example">(%i2) load("stats")$
(%i3) X:matrix(
[58,111,64],[84,131,78],[78,158,83],
[81,147,88],[82,121,89],[102,165,99],
[85,174,101],[102,169,102])$
(%i4) fpprintprec: 4$
(%i5) res: linear_regression(X);
| LINEAR REGRESSION MODEL
|
| b_estimation = [9.054, .5203, .2397]
|
| b_statistics = [.6051, 2.246, 1.74]
|
| b_p_values = [.5715, .07466, .1423]
|
(%o5) | b_distribution = [student_t, 5]
|
| v_estimation = 35.27
|
| v_conf_int = [13.74, 212.2]
|
| v_distribution = [chi2, 5]
|
| adc = .7922
(%i6) items_inference(res);
(%o6) [b_estimation, b_covariances, b_conf_int, b_statistics,
b_p_values, b_distribution, v_estimation, v_conf_int,
v_distribution, residuals, adc, aic, bic]
(%i7) take_inference('b_covariances, res);
[ 223.9 - 1.12 - .8532 ]
[ ]
(%o7) [ - 1.12 .05367 - .02305 ]
[ ]
[ - .8532 - .02305 .01898 ]
(%i8) take_inference('bic, res);
(%o8) 30.98
(%i9) load("draw")$
(%i10) draw2d(
points_joined = true,
grid = true,
points(take_inference('residuals, res)) )$
</pre>
<div class=categorybox>
·
<p>@ref{Category: Package stats} ·
@ref{Category: Statistical estimation}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-Functions-and-Variables-for-special-distributions"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-special-distributions"></a>
<a name="SEC371"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC370" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC367" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC367" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_83.html#SEC392" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.4 Functions and Variables for special distributions </h2>
<p><a name="Item_003a-pdf_005fsigned_005frank"></a>
</p><dl>
<dt><u>Function:</u> <b>pdf_signed_rank</b><i> (<var>x</var>, <var>n</var>)</i>
<a name="IDX2380"></a>
</dt>
<dd><p>Probability density function of the exact distribution of the
signed rank statistic. Argument <var>x</var> is a real
number and <var>n</var> a positive integer.
</p>
<p>See also <code>test_signed_rank</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-cdf_005fsigned_005frank"></a>
</p><dl>
<dt><u>Function:</u> <b>cdf_signed_rank</b><i> (<var>x</var>, <var>n</var>)</i>
<a name="IDX2381"></a>
</dt>
<dd><p>Cumulative density function of the exact distribution of the
signed rank statistic. Argument <var>x</var> is a real
number and <var>n</var> a positive integer.
</p>
<p>See also <code>test_signed_rank</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-pdf_005frank_005fsum"></a>
</p><dl>
<dt><u>Function:</u> <b>pdf_rank_sum</b><i> (<var>x</var>, <var>n</var>, <var>m</var>)</i>
<a name="IDX2382"></a>
</dt>
<dd><p>Probability density function of the exact distribution of the
rank sum statistic. Argument <var>x</var> is a real
number and <var>n</var> and <var>m</var> are both positive integers.
</p>
<p>See also <code>test_rank_sum</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-cdf_005frank_005fsum"></a>
</p><dl>
<dt><u>Function:</u> <b>cdf_rank_sum</b><i> (<var>x</var>, <var>n</var>, <var>m</var>)</i>
<a name="IDX2383"></a>
</dt>
<dd><p>Cumulative density function of the exact distribution of the
rank sum statistic. Argument <var>x</var> is a real
number and <var>n</var> and <var>m</var> are both positive integers.
</p>
<p>See also <code>test_rank_sum</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package stats}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-stirling"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC367" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC372" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_83.html#SEC392" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>December, 5 2016</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|