This file is indexed.

/usr/share/gretl/gretlcmd.hlp.pt is in gretl-common 2016a-1.

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
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
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
1726
1727
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
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
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
1847
1848
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
1875
1876
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
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
# add Tests

Argument: 	<@var="lista-de-variáveis"> 
Options: 	<@lit="--lm"> (fazer um teste LM, apenas para OLS (Ordinary Least Squares))
		<@lit="--quiet"> (mostrar apenas o resultado básico do teste)
		<@lit="--silent"> (não mostrar nada)
		<@lit="--vcv"> (mostrar matriz de covariância para o modelo aumentado)
		<@lit="--both"> (apenas para estimação IV, ver abaixo)
Examples: 	<@lit="add 5 7 9">
		<@lit="add xx yy zz --quiet">

Tem que ser invocado após um comando de estimação. As variáveis na <@var="lista-de-variáveis"> são acrescentadas ao modelo anterior e o novo modelo é estimado. Os resultados do teste de significância conjunta podem ser obtidos usando os acessores <@lit="$test"> e <@lit="$pvalue">. 

Por omissão é efetuada uma estimação da versão aumentada do modelo original, com a inclusão das variáveis da <@lit="lista-de-variáveis">. O teste é um teste de Wald sobre o modelo aumentado, que substitui o original como o "modelo corrente" para o propósito de, por exemplo, obter os resíduos como <@lit="$uhat"> ou realizar mais testes. 

Em alternativa, usando a opção <@opt="--⁠lm"> (apenas no caso de modelos estimados por OLS), será efetuado um teste LM. Uma regressão auxiliar é executada, na qual a variável dependente é o resíduo do modelo anterior e as variáveis independentes são as mesmas do modelo anterior mais as da <@lit="lista-de-variáveis">. De acordo com a hipótese nula de que as variáveis acrescentadas não acrescentam poder explicativo, a dimensão da amostra vezes o R quadrado não-ajustado desta regressão tem uma distribuição Qui-quadrado com um grau de liberdade igual ao número de regressores adicionado. Neste caso o modelo original não é alterado. 

A opção <@lit="--both"> é específico para o método dos mínimos quadrados de duas fases: indica que as novas variáveis devem ser acrescentadas tanto à lista de regressores como à lista de instrumentos, por omissão apenas serão acrescentadas à lista de regressores. 

Menu path: Janela do modelo, /Testes/Acrescentar variáveis

# adf Tests

Arguments: 	<@var="ordem"> <@var="lista-de-variáveis"> 
Options: 	<@lit="--nc"> (teste sem constante)
		<@lit="--c"> (apenas com constante)
		<@lit="--ct"> (com constante e tendência)
		<@lit="--ctt"> (com constante, tendência e quadrado da tendência)
		<@lit="--seasonals"> (incluir variáveis sazonais auxiliares)
		<@lit="--gls"> (atenuar média ou tendência usando GLS)
		<@lit="--verbose"> (mostrar resultados da regressão)
		<@lit="--quiet"> (não mostrar resultados)
		<@lit="--difference"> (usar a primeira diferença da variável)
		<@lit="--test-down">[=<@var="critério">] (ordem de desfasamento automática)
		<@lit="--perron-qu"> (ver abaixo)
Examples: 	<@lit="adf 0 y">
		<@lit="adf 2 y --nc --c --ct">
		<@lit="adf 12 y --c --test-down">
		See also <@inp="jgm-1996.inp">

The options shown above and the discussion which follows pertain to the use of the <@lit="adf"> command with regular time series data. For use of this command with panel data please see below. 

Computes a set of Dickey–Fuller tests on each of the the listed variables, the null hypothesis being that the variable in question has a unit root. (But if the <@opt="--⁠difference"> flag is given, the first difference of the variable is taken prior to testing, and the discussion below must be taken as referring to the transformed variable.) 

Por omissão, são apresentadas duas variantes do teste: uma baseada na regressão contendo uma constante e uma usando uma constante e uma tendência linear. Você pode controlar as variantes que são apresentadas ao especificar uma ou mais opções. 

The <@opt="--⁠gls"> option can be used in conjunction with one or other of the flags <@opt="--⁠c"> and <@opt="--⁠ct"> (the model with constant, or model with constant and trend). The effect of this option is that the de-meaning or de-trending of the variable to be tested is done using the GLS procedure suggested by <@bib="Elliott, Rothenberg and Stock (1996);ERS96">, which gives a test of greater power than the standard Dickey–Fuller approach. This option is not compatible with <@opt="--⁠nc">, <@opt="--⁠ctt"> or <@opt="--⁠seasonals">. 

Em todos os casos a variável dependente é a primeira diferença da variável especificada, <@mth="y">, e a variável independente chave é o primeiro desfasamento de <@mth="y">. O modelo é construido de modo a que o coeficiente do desfasamento de <@mth="y"> iguale a raiz em questão menos 1. Por exemplo, o modelo com uma constante pode ser escrito como 

  <@fig="adf1">

Under the null hypothesis of a unit root the coefficient on lagged <@mth="y"> equals zero; under the alternative that <@mth="y"> is stationary this coefficient is negative. 

Se a <@var="ordem"> de desfasamento (daqui em diante, <@mth="k">) é maior que 0, então <@mth="k"> desfasamentos da variável dependente são incluidos no lado direito das regressões de teste. If the order is given as –1, <@mth="k"> is set following the recommendation of <@bib="Schwert (1989);schwert89">, namely the integer part of 12(<@mth="T">/100)<@sup="0.25">, where <@mth="T"> is the sample size. Se a opção <@lit="--test-down"> foi dada, <@mth="k"> é considerada como sendo o desfasamento <@itl="máximo"> e a ordem de desfasamento efectivamente usada é obtida testando para baixo. O critério para testar para baixo pode ser selecionado usando o parâmetro opcional, que deve ser um de <@lit="AIC">, <@lit="BIC"> ou <@lit="tstat">; por omissão é <@lit="AIC">. 

When testing down via AIC or BIC is called for, the final lag order for the ADF equation is that which optimizes the chosen information criterion (Akaike or Schwarz Bayesian). The exact procedure depends on whether or not the <@opt="--⁠gls"> option is given: when GLS detrending is specified, AIC and BIC are the "modified" versions described in <@bib="Ng and Perron (2001);ng-perron01">, otherwise they are the standard versions. In the GLS case a refinement is available: if the additional option <@opt="--⁠perron-qu"> is given, the modified information criteria are computed according to the revised method recommended by <@bib="Perron and Qu (2007);perron-qu07">. 

When testing down via the <@mth="t">-statistic method is called for, the procedure is as follows: 

<indent>
1. Estimar a regressão de Dickey–Fuller com <@mth="k"> desfasamentos da variável dependente. 
</indent>

<indent>
2. O último desfasamento é significante? Se sim, executar o teste com com a ordem de desfasamento, <@mth="k">. Senão, fazer <@mth="k"> = <@mth="k"> – 1; se <@mth="k"> for igual a 0, executar o teste com a ordem de desfasamento 0, senão saltar para o passo 1. 
</indent>

No contexto do passo 2 acima, "significante" quer dizer que para o último desfasamento, a estatística-<@mth="t">, que segue uma distribuição normal, tem um <@itl="p"> valor bilateral assimptótico menor ou igual a 0,10. 

Os <@itl="p"> valores para os testes de Dickey–Fuller baseiam-se em MacKinnon (1996). O código relevante é incluído com a generosa permissão do autor. In the case of the test with linear trend using GLS these <@itl="P">-values are not applicable; critical values from Table 1 in <@bib="Elliott, Rothenberg and Stock (1996);ERS96"> are shown instead. 

<@itl="Panel data"> 

When the <@lit="adf"> command is used with panel data, to produce a panel unit root test, the applicable options and the results shown are somewhat different. 

First, while you may give a list of variables for testing in the regular time-series case, with panel data only one variable may be tested per command. Second, the options governing the inclusion of deterministic terms become mutually exclusive: you must choose between no-constant, constant only, and constant plus trend; the default is constant only. In addition, the <@opt="--⁠seasonals"> option is not available. Third, the <@opt="--⁠verbose"> option has a different meaning: it produces a brief account of the test for each individual time series (the default being to show only the overall result). 

The overall test (null hypothesis: the series in question has a unit root for all the panel units) is calculated in one or both of two ways: using the method of <@bib="Im, Pesaran and Shin (Journal of Econometrics, 2003);IPS03"> or that of <@bib="Choi (Journal of International Money and Finance, 2001);choi01">. 

Menu path: /Variável/Teste de Dickey-Fuller aumentado

# anova Statistics

Arguments: 	<@var="response"> <@var="treatment"> [ <@var="block"> ] 
Option: 	<@lit="--quiet"> (não mostrar resultados)

Análise de Variância: <@var="response"> é uma série que mede um efeito com interesse e <@var="treatment"> tem que ser uma variável discreta que codifica dois ou mais tipos de tratamento (ou não-tratamento). Para ANOVA de duas-vias, a variável <@var="block"> (que também deve ser discreta) codifica os valores de uma variável de controlo. 

Quando não se usa a opção <@opt="--⁠quiet">, este comando mostra a tabela das somas de quadrados e médias quadradas juntamente com um teste <@mth="F">. O teste <@mth="F"> e o seu valor P podem ser obtidos usando os acessores <@lit="$test"> e <@lit="$pvalue"> respetivamente. 

A hipótese nula do teste <@mth="F"> é de que a resposta média é invariante com o tipo de tratamento, ou por outras palavras, que o tratamento não produz efeito. Em termos formais, o teste é apenas válido se a variância da resposta for igual para todos os tipos de tratamentos. 

Note que os resultados apresentados por este comando pertencem a um subconjunto da informação resultante do procedimento seguinte, que é facilmente implementável em gretl. Crie um conjunto de variáveis auxiliares que codifiquem todos os tipos de tratamentos, exceto um. No caso da ANOVA de duas-vias, adicionalmente, crie um conjunto de variáveis auxiliares que codifiquem todos os "blocks" (controlos), exceto um. De seguida efectue uma regressão sobre <@var="response"> com uma constante e com as variáveis auxiliares usando <@ref="ols">. No caso da ANOVA singular (ou uma-via) a tabela é produzida passando a opção <@opt="--⁠anova"> para <@lit="ols">. No caso da ANOVA de duas-vias o teste F relevante, é obtido usando o comando <@ref="omit">. Por exemplo (assumindo que <@lit="y"> é a resposta, <@lit="xt"> codifica os tratamentos, e <@lit="xb"> codifica os controlos): 

<code>          
   # uma-via
   list dxt = dummify(xt)
   ols y 0 dxt --anova
   # duas-vias
   list dxb = dummify(xb)
   ols y 0 dxt dxb
   # teste da significância conjunta de dxt
   omit dxt --quiet
</code>

Menu path: /Modelo/Outros modelos lineares/ANOVA

# append Dataset

Argument: 	<@var="ficheiro-de-dados"> 
Options: 	<@lit="--time-series"> (ver abaixo)
		<@lit="--update-overlap"> (ver abaixo)
		Ver abaixo para opções especializadas adicionais

Abre um ficheiro de dados e acrescenta esse conteúdo ao conjunto de dados actual, se os novos dados forem compatíveis. O programa tentará determinar o formato do ficheiro de dados (nativo, texto simples, CSV, Gnumeric, Excel, etc.). 

Os dados acrescentados podem tomar a forma de observações adicionais em variáveis já existentes, ou em novas variáveis. Caso sejam novas variáveis, estas terão que ser compatíveis de acordo com: (a) o número de observações dos novos dados seja o mesmo que nos dados existentes, ou (b) que os novos dados estejam acompanhados de informação clara sobre as observações de modo que gretl possa decidir onde colocar os valores. 

Existe uma funcionalidade especial para acrescentar a um conjunto de dados de painel. Seja <@mth="n"> o número de unidades de secção cruzada no painel, <@mth="T"> o número de períodos temporais, e <@mth="m"> o número de observações dos novos dados. Se <@mth="m = n"> os novos dados serão tomados como invariantes-temporais, e serão copiados para a posição em cada período temporal. Por outro lado, se <@mth="m = T"> os dados serão tratados como sendo não-variantes a longo das unidades de painel, e serão copiados para a posição em cada unidade. Se o painel é "quadrado", e <@mth="m"> é igual a <@mth="n"> e a <@mth="T">, acontece uma ambiguidade. Neste caso, por omissão, trata-se cada novos dados como sendo invariantes-temporais, mas você pode forçar gretl para tratar os novos dados como sendo série temporal ao fornecer a opção <@opt="--⁠time-series">. (Esta opção é ignorada nos outros casos.) 

When a data file is selected for appending, there may be an area of overlap with the existing dataset; that is, one or more series may have one or more observations in common across the two sources. If the option <@opt="--⁠update-overlap"> is given, the <@lit="append"> operation will replace any overlapping observations with the values from the selected data file, otherwise the values currently in place will be unaffected. 

The additional specialized options <@opt="--⁠sheet">, <@opt="--⁠coloffset">, <@opt="--⁠rowoffset"> and <@opt="--⁠fixed-cols"> work in the same way as with <@ref="open">; see that command for explanations. 

Ver também o comando <@ref="join"> para um manuseamento mais sofisticado com várias fontes de dados. 

Menu path: /Ficheiro/Acrescentar dados

# ar Estimation

Arguments: 	<@var="desfasamentos"> ; <@var="variável-dependente"> <@var="variáveis-independentes"> 
Option: 	<@lit="--vcv"> (mostrar matriz de covariância)
Example: 	<@lit="ar 1 3 4 ; y 0 x1 x2 x3">

Determina estimativas para os parâmetros usando o procedimento iteractivo e generalizado de Cochrane–Orcutt (ver a Secção 9.5 de Ramanathan, 2002). A iteração termina quando os erros das somas de quadrados sucessivos não difiram em mais que 0,005 porcento ou após 20 iterações. 

<@var="desfasamentos"> é uma lista de desfasamentos nos resíduos, terminada por um ponto-e-vírgula. No exemplo acima o termo do erro é especificado como 

  <@fig="arlags">

Menu path: /Modelo/Série temporal/Estimação autoregressiva

# ar1 Estimation

Arguments: 	<@var="variável-dependente"> <@var="variáveis-independentes"> 
Options: 	<@lit="--hilu"> (usar o procedimento Hildreth–Lu)
		<@lit="--pwe"> (usar o estimador Prais–Winsten)
		<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--no-corc"> (não aperfeiçoar os resultados com Cochrane-Orcutt)
		<@lit="--loose"> (usar critério de convergência mais relaxado)
Examples: 	<@lit="ar1 1 0 2 4 6 7">
		<@lit="ar1 y 0 xlist --pwe">
		<@lit="ar1 y 0 xlist --hilu --no-corc">

Determina estimativas admissíveis GLS para um modelo em que se assume que o termo de erro segue um processo autoregressivo de primeira-ordem. 

O método por omissão é o procedimento iterativo de Cochrane–Orcutt (ver, por exemplo, a Secção 9.4 de Ramanathan, 2002). A iteração termina quando as estimativas sucessivas do coeficiente de autocorrelação não diferirem por mais de 0.001 ou após 20 iterações. 

Se tiver sido dada a opção <@lit="--hilu">, é utilizado o procedimento de pesquisa de Hildreth–Lu. Os resultados são depois aperfeiçoados usando o método Cochrane–Orcutt, exceto se tiver sido indicada a opção <@lit="--no-corc">. (Esta última opção é ignorada se não tiver sido usado <@lit="--hilu">). 

Se tiver sido dada a opção <@lit="--pwe">, é usado o estimador de Prais–Winsten. Isto involve uma iteração semelhante à de Cochrane–Orcutt; a diferença é que equanto Cochrane–Orcutt descarta a primeira observação, a de Prais–Winsten faz uso dela. Para mais detalhes ver, por exemplo, o Capítulo 13 do livro de Greene, <@itl="Econometric Analysis"> (2000). 

Menu path: /Modelo/Série temporal/AR(1)

# arbond Estimation

Argument: 	<@var="p"> [ <@var="q"> ] ; <@var="variável-dependente"> <@var="variáveis-independentes"> [ ; <@var="instrumentos"> ] 
Options: 	<@lit="--quiet"> (não mostrar o modelo estimado)
		<@lit="--vcv"> (mostrar matriz de covariância)
		<@lit="--two-step"> (executa estimação pelo Método Generalizado dos Momentos (GMM) de 2-fases)
		<@lit="--time-dummies"> (acrescenta variáveis auxiliares tempo)
		<@lit="--asymptotic"> (erros padrão assimptóticos não corrigidos)
Examples: 	<@lit="arbond 2 ; y Dx1 Dx2">
		<@lit="arbond 2 5 ; y Dx1 Dx2 ; Dx1">
		<@lit="arbond 1 ; y Dx1 Dx2 ; Dx1 GMM(x2,2,3)">
		See also <@inp="arbond91.inp">

Executa a estimação de modelos de painel dinâmico (ou seja, modelos de painel que contenham um ou mais desfasamentos da variável dependente) recorrendo ao método Método Generalizado dos Momentos (GMM-DIF) desenvolvido por <@bib="Arellano and Bond (1991);arellano-bond91">. Por favor ver <@ref="dpanel"> para uma versão mais flexível e actualizada deste comando que também usa GMM-SYS para além do GMM-DIF. 

O parâmetro <@var="p"> representa a ordem da autoregressão para a variável dependente. O parâmetro opcional <@var="q"> indica o máximo desfasamento do nível da variável dependente a ser usada como um instrumento. Se este argumento for omitido, ou de valor 0, todos os desfasamentos disponíveis são usados. 

A variável dependente deve ser dada na forma de níveis; ela será automaticamente diferenciada (pois este estimador usa diferenciação para anular os efeitos individuais). As variáveis independentes não são automaticamente diferenciadas; se você pretende usar diferenças (o que acontece em geral para variáveis quantitativas, mas não será, por exemplo, para variáveis auxiliares temporais), deve primeiro criar essas diferenças e depois especificar estas como sendo regressoras. 

O último campo (opcional) do comando serve para especificar instrumentos. Se não for dado nenhum, então é assumido que todas as variáveis independentes são estritamente exógenas. Se você especificar alguns instrumentos, então deve incluir na lista quaisquer variáveis independentes estritamente exógenas. Para regressores predeterminados, você pode usar a função <@lit="GMM"> para incluir uma gama de desfasamentos especificada no modo bloco-diagonal. Isto é ilustrado no terceiro exemplo acima. O primeiro argumento de <@lit="GMM"> é o nome da variável em questão, o segundo é o desfasamento mínimo a ser usado como instrumento, e o terceiro é o desfasamento máximo. Se o terceiro argumento for dado como 0, todos os desfasamentos disponíveis são usados. 

Por omissão são apresentados os resultados da estimação 1-fase (com erros padrão robustos). Opcionalmente, você pode escolher estimação de 2-fases. Em ambos os casos são efectuados testes de autocorrelação de ordem 1 e 2, assim como o teste de sobre-identificação de Sargan e o teste de Wald para a significância conjunta dos regressores. Note-se que este modelo de diferenciação com autocorrelação de primeira-ordem não invalida o modelo, mas que a autocorrelação de segunda-ordem não respeita as assunções estatísticas presentes. 

No caso da estimação de 2-fases, por omissão, os erros padrão são determinados usando a correcção de amostra-finita sugerida por <@bib="Windmeijer (2005);windmeijer05">. Os erros padrão assimptóticos associados ao estimador de 2-fases são em geral considerados como guias para inferência pouco fiáveis, mas se por alguma razão os pretender ver, você pode usar a opção <@lit="--asymptotic"> para desligar a correcção de Windmeijer. 

Se for dada a opção <@lit="--time-dummies">, são acrescentadas variáveis auxiliares temporais aos regressores especificados. Para evitar colinearidade perfeita com a constante, o número de auxiliares é uma unidade a menos que o número máximo de períodos usados na estimação. As auxiliares são introduzidas por níveis; se você deseja usar auxiliares de tempo na forma de primeiras-diferenças, você terá que definir e acrescentar essas variáveis manualmente. 

Menu path: /Modelo/Painel/Arellano-Bond

# arch Estimation

Arguments: 	<@var="ordem"> <@var="variável-dependente"> <@var="variáveis-independentes"> 
Example: 	<@lit="arch 4 y 0 x1 x2 x3">

This command is retained at present for backward compatibility, but you are better off using the maximum likelihood estimator offered by the <@ref="garch"> command; for a plain ARCH model, set the first GARCH parameter to 0. 

Estima a especificação do modelo fornecido aceitando em ARCH (Heterosquedicidade Condicional Autoregressiva). O modelo é primeiramente estimado em OLS, e depois é efectuada uma regressão auxiliar, na qual, o quadrado dos resíduos da primeira fase é regredido com os seus próprios valores desfasados. A fase final é uma estimação por mínimos quadrados com pesos, usando como pesos os recíprocos das variâncias de erro ajustadas da regressão auxiliar. (Se a variância predita de de alguma observação na regressão auxiliar for não positiva, então será usada o correspondente resíduo quadrado). 

Os valores <@lit="alpha"> mostrados abaixo dos coeficientes são os parâmetros estimados do processo ARCH da regressão auxiliar. 

Ver também <@ref="garch"> e <@ref="modtest"> (a opção <@opt="--⁠arch">). 

Menu path: /Modelo/Série temporal/ARCH

# arima Estimation

Arguments: 	<@var="p"> <@var="d"> <@var="q"> [ ; <@var="P"> <@var="D"> <@var="Q"> ] ; <@var="variável-dependente"> [ <@var="variáveis-independentes"> ] 
Options: 	<@lit="--verbose"> (mostrar detalhes das iterações)
		<@lit="--vcv"> (mostrar matriz de covariância)
		<@lit="--hessian"> (ver abaixo)
		<@lit="--opg"> (ver abaixo)
		<@lit="--nc"> (não incluir uma constante)
		<@lit="--conditional"> (usar verosimilhança máxima condicional)
		<@lit="--x-12-arima"> (usar X-12-ARIMA para estimação)
		<@lit="--lbfgs"> (usar maximizador L-BFGS-B)
		<@lit="--y-diff-only"> (ARIMAX especial, ver abaixo)
		<@lit="--save-ehat"> (ver abaixo)
Examples: 	<@lit="arima 1 0 2 ; y">
		<@lit="arima 2 0 2 ; y 0 x1 x2 --verbose">
		<@lit="arima 0 1 1 ; 0 1 1 ; y --nc">

Se não for dada a lista de <@var="variáveis-independentes">, é estimado um modelo ARIMA (Média Móvel, Autoregressiva, Integrada) univariado. O valores inteiros <@var="p">, <@var="d"> e <@var="q"> representam respectivamente, a ordem autoregressiva (AR), a ordem de diferenciação, e ordem da média móvel (MA). Estes valores podem ser fornecidos na forma numérica, ou como nome de variáveis escalares pré-existentes. Por exemplo, um valor de 1 em <@var="d">, significa que a primeira diferença da variável dependente deve ser obtida antes de estimar os parâmetros ARMA. 

Se você pretender apenas incluir no modelo desfasamentos específicos AR ou MA (e não todos os desfasamentos até uma certa ordem) você pode substituir <@var="p"> e/ou <@var="q"> de acordo com: (a) o nome de uma matriz pré-definida contendo um conjunto de valores inteiros, ou (b) uma expressão tal como <@lit="{1 4}">; ou seja, um conjunto de desfasamentos separados por espaços dentro de chavetas. 

Os valores inteiros opcionais,<@var="P">, <@var="D"> e <@var="Q"> representam respectivamente, a sazonalidade AR, a ordem para diferenciação de sazonalidade e a ordem de sazonalidade MA. Estes são apenas aplicáveis se os dados tiverem uma frequência superior a 1 (por exemplo, trimestral ou mensal). Mais uma vez, estas ordens podem ser dadas na forma numérica ou como variáveis. 

No caso univariado é incluído no modelo por omissão, um interceptor, mas isto pode ser suprimido com a opção <@lit="--nc">. Se forem fornecidas <@var="variáveis-independentes">, o modelo passa a ser ARMAX; neste caso a constante deve ser explicitamente incluída se você pretender um interceptor (tal como no segundo exemplo acima). 

Existe outra forma alternativa para este comando: se você não pretende aplicar diferenciação (seja sazonal ou não-sazonal), você pode omitir ambos os parâmetros <@var="d"> e <@var="D">, em vez de entrar explicitamente zeros. Além disso, <@lit="arma"> é um sinónimo ou aliás para <@lit="arima">. Assim, por exemplo, o comando seguinte é válido para especificar o modelo ARMA(2, 1): 

<code>          
   arma 2 1 ; y
</code>

O normal é usar a funcionalidade "nativa" gretl ARMA, com estimação de Máxima Verosimilhança (ML) exata (usando o filtro de Kalman). Outras opções são: código nativo, ML condicional; X-12-ARIMA, ML exata; e X-12-ARIMA, ML condicional. (As últimas duas opções estão disponíveis apenas se o programa X-12-ARIMA estiver instalado.) Para detalhes sobre estas opções, veja por favor <@pdf="the Gretl User's Guide">. 

Quando o código nativo ML é usado, os erros padrão são por omissão baseados numa aproximação numérica da (inversa negativa da) Hessiana, ou em recurso, no produto externo do gradiente (OPG) caso falhe o cálculo da Hessiana numérica. Podem ser usadas duas opções (mutualmente exclusivas) para forçar a situação: a opção <@opt="--⁠opg"> força o uso do método OPG, sem tentar obter a Hessiana, enquanto a opção <@opt="--⁠hessian"> desativa o OPG em último recurso. Note que a falha na determinação da Hessiana numérica indica, em geral um modelo incorretamente especificado. 

A opção <@opt="--⁠lbfgs"> é específica para estimação usando código nativo ARMA e ML exata: significa o uso do algoritmo de "memória limitada" L-BFGS-B em vez do usual maximizador BFGS. Isto pode ajudar em alguns casos onde a convergência é difícil de atingir. 

A opção <@opt="--⁠y-diff-only"> é específica na estimação de modelos ARIMAX (modelos com uma ordem de integração não-nula e que incluam regressores exógenos), e aplica-se apenas quando se usa a ML exata e nativa de gretl. Para esses modelos o comportamento normal é de diferenciar tanto as variáveis dependentes como as regressoras, mas quando esta opção é fornecida, apenas é diferenciada a variável dependente, mantendo-se as variáveis regressoras na forma de nível. 

A opção <@opt="--⁠save-ehat"> é aplicável apenas quando se usa estimação ML nativa e exata. O efeito é o de disponibilizar um vector contendo a estimativa óptima de período <@mth="t"> da perturbação data-<@mth="t"> ou inovação: isto pode ser recuperado com o uso do acessor <@lit="$ehat">. Estes valores diferem da série dos resíduos (<@lit="$uhat">), que contém os erros de predição um-passo-à-frente. 

O valor AIC retornado em ligação com os modelos ARIMA é calculado conforme a definição usada no programa X-12-ARIMA, nomeadamente 

  <@fig="aic">

onde <@fig="ell"> é o logaritmo da verosimilhança e <@mth="k"> é o número total de parâmetros estimados. Note-se que o programa X-12-ARIMA não produz critérios de informação tal como o AIC quando a estimação é por ML condicional. 

As raízes AR e MA apresentadas em ligação com a estimação ARMA são baseadas na seguinte representação de um processo ARMA(p,q): 

<mono>          
   (1 - a_1*L - a_2*L^2 - ... - a_p*L^p)Y =
          c + (1 + b_1*L + b_2*L^2 + ... + b_q*L^q) e_t
</mono>

As raízes AR são portanto as soluções de 

<mono>          
         1 - a_1*z - a_2*z^2 - ... - a_p*L^p = 0
</mono>

e a estabilidade requer que estas raízes estejam fora do círculo unitário. 

A imagem da "frequência" apresentada em ligação com as raízes AR e MA é o valor λ que resolve <@mth="z"> = <@mth="r"> * exp(i*2*π*λ) onde <@mth="z"> é a raiz em questão e <@mth="r"> o seu módulo. 

Menu path: /Modelo/Série temporal/ARIMA
Other access: Menu de contexto da janela principal (selecção singular)

# biprobit Estimation

Arguments: 	<@var="variável-dependente1"> <@var="variável-dependente2"> <@var="variáveis-independentes1"> [ ; <@var="variáveis-independentes2"> ] 
Options: 	<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--robust"> (erros padrão robustos)
		<@lit="--cluster">=<@var="variável-agrupada"> (ver a explicação em <@ref="logit">)
		<@lit="--opg"> (ver abaixo)
		<@lit="--save-xbeta"> (ver abaixo)
		<@lit="--verbose"> (mostrar informação adicional)
Examples: 	<@lit="biprobit y1 y2 0 x1 x2">
		<@lit="biprobit y1 y2 0 x11 x12 ; 0 x21 x22">
		See also <@inp="biprobit.inp">

Estima um modelo probit bivariado, usando o método de Newton–Raphson para maximizar a verosimilhança. 

A lista de argumentos começa com as duas variáveis dependentes (binárias), seguidas pela lista de regressores. Se a segunda lista tiver sido dada, separada por um ponto-e-vírgula, ela será interpretada como sendo o conjunto de regressores para a segunda equação, e as <@var="variáveis-independentes1"> são específicas para a primeira equação; caso contrário as <@var="variáveis-independentes1"> são consideradas representando o conjunto de regressores comum. 

Por omissão, os erros padrão são calculados usando uma aproximação númerica por convergência da Hessiana. Mas se tiver sido dada a opção <@opt="--⁠opg"> a matriz de covariância será baseada no produto externo do gradiente (OPG), ou se a opção <@opt="--⁠robust"> tiver sido dada, o erros padrão QML serão calulados usando a "sandwich" entre a inversa da Hessiana e a OPG. 

Depois duma estimação com sucesso, o acessor <@lit="$uhat"> obtém uma matriz de duas colunas que são os resíduos generalizados das duas equações; ou seja, os valores esperados das perturbações condicionadas pelos resultados observados e covariados. Por omissão o <@lit="$yhat"> obtém a matriz com quatro colunas, que são as probabilidades estimadas para os quatro possíveis resultados conjuntos para (<@mth="y"><@sub="1">, <@mth="y"><@sub="2">), e pela ordem (1,1), (1,0), (0,1), (0,0). Alternativamente, se tiver sido usada a opção <@lit="--save-xbeta">, o <@lit="$yhat"> tem duas colunas e contém os valores das funções de índice para as respectivas equações. 

A saída inclui o teste de razões de verosimilhança para a hipótese nula de que as perturbações nas duas equações são não-correlacionadas. 

# boxplot Graphs

Argument: 	<@var="lista-de-variáveis"> 
Options: 	<@lit="--notches"> (mostrar intervalo de 90 porcento para a mediana delimitado por entalhes)
		<@lit="--factorized"> (ver abaixo)
		<@lit="--panel"> (ver abaixo)
		<@lit="--matrix">=<@var="nome"> (mostra o gráfico das colunas da matriz indicada)
		<@lit="--output">=<@var="nome-de-ficheiro"> (envia a saída para o ficheiro especificado)

Estes gráficos apresentam a distribuição de uma variável. A caixa central contém os 50 porcento dos dados centrais, i.e. está limitada pelos primeiro e terceiro quartis. Os "bigodes" estendem-se até aos valores mínimo e máximo. É desenhada uma linha que corta a caixa na mediana. Um símbolo "+" indica a média. Se tiver sido selecionada a opção de mostrar o intervalo de confiança para a média, ele é obtido pelo método 'bootstrap' e apresentado na forma de linhas a tracejado acima e abaixo da mediana. 

A opção <@opt="--⁠factorized"> permite examinar a distribuição de uma variável condicionada pelo valor de um fator discreto. Por exemplo, se um conjunto de dados contém salários e uma variável auxiliar para o sexo, você pode selecionar a variável salário como alvo e o sexo como fator para visualizar lado a lado gráficos caixas-com-bigodes dos salários de homens e mulheres, como em 

<code>          
   boxplot salario sexo --factorized
</code>

Note que neste caso você tem que especificar exatamente duas variáveis, com a variável fator em segundo lugar. 

Se o conjunto de dados atual é de painel, e apenas tiver sido especificada uma variável, a opção <@opt="--⁠panel"> produz uma série de gráficos caixas-com-bigodes lado a lado, para cada uma das "unidades" do painel ou grupo. 

Em modo interativo o resultado é mostrado imediatamente. Em modo lote ('batch') o comportamento normal é o de criar um ficheiro de comandos gnuplot na diretoria de trabalho do utilizador, cujo nome segue a forma <@lit="gpttmpN.plt">, iniciando com N = <@lit="01">. Esses gráficos poderão ser posteriormente gerados com o programa gnuplot (em MS Windows, wgnuplot). Este comportamento pode ser modificado usando a opção <@opt="--⁠output="> <@var="nome-de-ficheiro">. Para mais detalhes, ver o comando <@ref="gnuplot">. 

Menu path: /Ver/Gráfico das variáveis/Caixa com bigodes

# break Programming

Sai de um ciclo. Este comando pode apenas ser usado dentro de um ciclo; ele termina a execução de comandos e sai de dentro do ciclo (o mais interior). Ver também <@ref="loop">. 

# catch Programming

Syntax: 	<@lit="catch "><@var="command">

Isto não é um comando em sentido estrito mas pode ser usado como um prefixo na maior parte dos comandos: o efeito é o de prevenir a eventual interrupção da execução de comandos (ou de um ficheiro de comandos) quando ocorra um erro num comando. Se acontecer um erro, este fica registado como sendo um erro interno que pode ser acedido com <@lit="$error"> (um valor de zero indica sucesso). O valor de <@lit="$error"> deve ser sempre verificado imediatamente a seguir ao uso de <@lit="catch">, e deve ser tomada a ação adequada se o comando falhou. 

A palavra reservada <@lit="catch"> não pode ser usada antes de <@lit="if">, <@lit="elif"> ou <@lit="endif">. 

# chow Tests

Variants: 	<@lit="chow"> <@var="observação">
		<@lit="chow"> <@var="variável-auxiliar"> <@lit="--dummy">
Options: 	<@lit="--dummy"> (usar uma variável auxiliar pré-existente)
		<@lit="--quiet"> (não mostrar estimativas para o modelo aumentado)
		<@lit="--limit-to">=<@var="list"> (limit test to subset of regressors)
Examples: 	<@lit="chow 25">
		<@lit="chow 1988:1">
		<@lit="chow female --dummy">

Tem que se seguir a uma regressão de Mínimos Quadrados (OLS). Se um número de observação ou uma data tiver sido dado, produz um teste sobre a hipótese nula de não haver quebra estrutural no ponto de separação indicado. O procedimento cria uma variável auxiliar que é igual a 1 a partir do ponto especificado por <@var="observação"> até ao final da amostra, caso contrário é 0, e cria também termos de interação entre esta variável auxiliar e as variáveis regressoras originais. Se tiver sido dada uma variável auxiliar, será testada a hipótese nula de homogeneidade estrutural no que diz respeito a essa variável auxiliar. Mais uma vez, os termos de interação são acrescentados. Em quaisquer dos casos, é executada uma regressão aumentada que inclui estes termos e é calculada a estatística <@mth="F">, considerando a regressão aumentada como não restringida e a original como restringida. Mas se o modelo original usou um estimador robusto para a matriz de covariância, a estatística de teste é um valor de qui-quadrado de Wald baseada num estimador robusto da matriz de covariância da regressão aumentada. 

Menu path: Janela do modelo, /Testes/Teste de Chow

# clear Programming

Option: 	<@lit="--dataset"> (apagar apenas o conjunto de dados)

Sem opções, apaga da memória todos os objetos gravados, incluindo o conjunto de dados corrente. Note que ao abrir um novo conjunto de dados, ou ao usar o comando <@lit="nulldata"> para criar um conjunto de dados vazio, obterá o mesmo efeito, por isso o uso de <@lit="clear"> normalmente não é necessário. 

Se tiver sido dada a opção <@lit="--dataset">, então apenas o conjunto de dados é apagado; os outros objetos gravados como matrizes e escalares serão preservados. 

# coeffsum Tests

Argument: 	<@var="lista-de-variáveis"> 
Examples: 	<@lit="coeffsum xt xt_1 xr_2">
		See also <@inp="restrict.inp">

Tem que se seguir a uma regressão. Calcula a soma dos coeficientes nas variáveis indicadas na <@var="lista-de-variáveis">. Apresenta esta soma juntamente com o seu erro padrão e o p-value para a hipótese nula de que a soma é zero. 

Note-se a diferença entre este teste e <@ref="omit">, que testa a hipótese nula de que os coeficientes num conjunto especificado de variáveis independentes são <@itl="todos"> iguais a zero. 

Menu path: Janela do modelo, /Testes/Soma de coeficientes

# coint Tests

Arguments: 	<@var="ordem"> <@var="variável-dependente"> <@var="variáveis-independentes"> 
Options: 	<@lit="--nc"> (não incluir uma constante)
		<@lit="--ct"> (incluir constante e tendência)
		<@lit="--ctt"> (incluir constante e tendência quadrática)
		<@lit="--skip-df"> (não efectuar testes DF nas variáveis individuais)
		<@lit="--test-down">[=<@var="criterion">] (ordem de desfasamento automática)
		<@lit="--verbose"> (mostrar detalhes adicionais das regressões)
		<@lit="--silent"> (don't print anything)
Examples: 	<@lit="coint 4 y x1 x2">
		<@lit="coint 0 y x1 x2 --ct --skip-df">

O teste de cointegração Engle–Granger. O procedimento por omissão é: (1) efetuar testes de Dickey–Fuller (DF) segundo a hipótese nula de que cada variável listada tem uma raiz unitária; (2) estima a regressão de cointegração; e (3) executar um teste DF sobre os resíduos da regressão de cointegração. Se for dada a opção <@lit="--skip-df">, o passo (1) é omitido. 

Se a ordem de desfasamento especificada é positiva, todos os testes Dickey–Fuller usam essa ordem, com esta qualificação: se a opção <@opt="--⁠test-down"> for dada, o valor indicado é tomado como sendo o máximo e a ordem de desfasamento efetivamente usada em cada caso é obtida testando para baixo. Ver o comando <@ref="adf"> para detalhes sobre este procedimento. 

Por omissão, a regressão de cointegração contém uma constante. Se você deseja suprimir a constante, acrescente a opção <@lit="--nc">. Se você deseja aumentar a lista de termos determinísticos na regressão de cointegração com uma tendência linear ou quadrática, use a opção <@lit="--ct"> ou <@lit="--ctt">. Estas opções são mutualmente exclusivas. 

Os <@itl="P-">values para este teste são baseados em MacKinnon (1996). O código relevante é incluído com a generosa permissão do autor. 

Menu path: /Modelo/Série temporal/Testes de Cointegração/Engle-Granger

# coint2 Tests

Arguments: 	<@var="ordem"> <@var="listaY"> [ ; <@var="listaX"> ] [ ; <@var="listaRx"> ] 
Options: 	<@lit="--nc"> (sem constante)
		<@lit="--rc"> (constante restringida)
		<@lit="--uc"> (constante não restringida)
		<@lit="--crt"> (constante e tendência restringida)
		<@lit="--ct"> (constante e tendência não restringida)
		<@lit="--seasonals"> (incluir auxiliares sazonais centradas)
		<@lit="--asy"> (registar valores p assimtóticos)
		<@lit="--quiet"> (apenas mostrar os testes)
		<@lit="--silent"> (não mostrar nada)
		<@lit="--verbose"> (mostrar detalhes das regressões auxiliares)
Examples: 	<@lit="coint2 2 y x">
		<@lit="coint2 4 y x1 x2 --verbose">
		<@lit="coint2 3 y x1 x2 --rc">

Executa o teste de Johansen para a cointegração entre as variáveis em <@var="listaY"> para a dada ordem de desfasamento. Para detalhes sobre este teste ver <@pdf="the Gretl User's Guide"> ou <@bib="Hamilton (1994);hamilton94">, Capítulo 20. Os valores p são calculados usando a aproximação gama de Doornik <@bib="(Doornik, 1998);doornik98">. São mostrados dois conjuntos de valores p para o teste traço, valores assintóticos imediatos e valores ajustados para o tamanho da amostra. Por omissão, o acessor <@lit="$pvalue"> obtém a variante ajustada, mas se opção <@opt="--⁠asy"> for dada, pode ser usado para registar os valores assintóticos. 

A inclusão de termos determinísticos no modelo é controlada por intermédio das opções. Por omissão, se não tiver sido indicada nenhuma opção, será incluída uma "constante não restringida", o que permite a presença de um interceptor não-nulo nas relações cointegrantes assim como uma tendência nos níveis das variáveis endógenas. Na literatura derivada do trabalho de Johansen (ver por exemplo o livro dele de 1995) isto é frequentemente referido como sendo o "caso 3". As primeiras quatro opções apresentadas acima, que são mutualmente exclusivas, produzem respectivamente os casos 1, 2, 4, e 5. O significado destes casos e os critérios para seleccionar um caso estão explicados no <@pdf="the Gretl User's Guide">. 

As listas opcionais <@var="listaX"> e <@var="listaRx"> permite-lhe controlar as variáveis exógenas: estas entram no sistema como não restringidas (<@var="listaX">) ou restringidas ao espaço de cointegração (<@var="listaRx">). Estas listas são separadas da <@var="listaY"> e entre elas usando ponto-e-vírgulas. 

A opção <@lit="--seasonals">, que pode ser combinada com qualquer outra opção, especifica a inclusão de um conjunto de variáveis auxiliares sazonais. Esta opção apenas está disponível para dados trimestrais ou mensais. 

A seguinte tabela serve como um guia à interpretação dos resultados apresentados pelo teste, num caso de 3-variáveis. <@lit="H0"> significa a hipótese nula, <@lit="H1"> a hipótese alternativa, e <@lit="c"> o número de relações cointegrantes. 

<mono>          
         Ordem    Teste Traço        Teste Lmax
                  H0     H1          H0     H1 
         ---------------------------------------
          0      c = 0  c = 3       c = 0  c = 1
          1      c = 1  c = 3       c = 1  c = 2
          2      c = 2  c = 3       c = 2  c = 3
         ---------------------------------------
</mono>

Ver também o comando <@ref="vecm">. 

Menu path: /Modelo/Série temporal/Testes de Cointegração/Johansen

# corr Statistics

Argument: 	[ <@var="lista-de-variáveis"> ] 
Options: 	<@lit="--uniform"> (garante amostra uniforme)
		<@lit="--spearman"> (Ró de Spearman)
		<@lit="--kendall"> (Tau de Kendall)
		<@lit="--verbose"> (mostra classificações ('rankings'))
Examples: 	<@lit="corr y x1 x2 x3">
		<@lit="corr ylist --uniform">
		<@lit="corr x y --spearman">

Por omissão, apresenta os coeficientes de correlação emparelhados (correlação momento-produto de Pearson) para as variáveis <@var="lista-de-variáveis">, ou para todas as variáveis no conjunto de dados se não tiver sido indicada <@var="lista-de-variáveis">. O comportamento normal é o de usar todas as observações disponíveis para calcular cada coeficiente emparelhado, mas se tiver sido dada a opção <@lit="--uniform"> a amostra será limitada (caso seja necessário) de modo que o mesmo conjunto de observações seja usado em todos os coeficientes. Esta opção apenas tem efeito se existirem valores omissos em quantidades diferentes para as variáveis usadas. 

As opções (mutualmente exclusivas) <@opt="--⁠spearman"> e <@opt="--⁠kendall"> produzem, respetivamente, o Ró de correlação de Spearman e o Tau de correlação de ordem de Kendall em vez do usual coeficiente de Pearson. Quando uma destas opções é dada, a <@var="lista-de-variáveis"> deve apenas conter duas variáveis. 

Ao calcular uma correlação de ordem, pode ser dada a opção <@opt="--⁠verbose"> para mostrar os dados originais e ordenados (caso contrário esta opção será ignorada). 

Menu path: /Ver/Matriz de correlação
Other access: Menu de contexto da janela principal (selecção múltipla)

# corrgm Statistics

Arguments: 	<@var="série"> [ <@var="ordem"> ] 
Options: 	<@lit="--bartlett"> (use Bartlett standard errors)
		<@lit="--plot">=<@var="modo ou nome-de-ficheiro"> (ver abaixo)
Example: 	<@lit="corrgm x 12">

Apresenta os valores da função de autocorrelação para a <@var="série">, que pode ser especificada por nome ou por número. Os valores são definidos como ρ(<@mth="u"><@sub="t">, <@mth="u"><@sub="t-s">) onde <@mth="u"><@sub="t"> é a <@mth="t">–ésima observação da variável <@mth="u"> e <@mth="s"> é o número de desfasamentos. 

Também são apresentadas as autocorrelações parciais (obtidas segundo o algoritmo de Durbin–Levinson): estas constituem a rede dos efeitos dos desfasamentos intervenientes. Adicionalmente, é apresentada a estatística de teste <@mth="Q"> de Ljung–Box. Esta pode ser usada para testar a hipótese nula de que a série é "ruído branco": terá uma distribuição qui-quadrado assimptótico com os graus de liberdade iguais ao número de desfasamentos usados. 

Se o valor <@var="ordem"> for especificado o comprimento do correlograma fica limitado a esse máximo número de desfasamentos, senão o comprimento é determinado automaticamente, como uma função da frequência dos dados e do número de observações. 

Por omissão é apresentado um gráfico do correlograma: um gráfico gnuplot em modo interativo ou um gráfico ASCII em modo de lote de comandos. Isto pode ser ajustado por via da opção <@opt="--⁠plot">. Os parâmetros válidos para esta opção são <@lit="none"> (para suprimir o gráfico); <@lit="ascii"> (para produzir um gráfico de texto mesmo em modo interativo); <@lit="display"> (para produzir um gráfico gnuplot mesmo em modo de lote de comandos); ou o nome de um ficheiro. O efeito de se fornecer um nome de ficheiro é como descrito para a opção <@opt="--⁠output"> do comando <@ref="gnuplot">. 

Depois de completar com sucesso, os acessores <@lit="$test"> e <@lit="$pvalue"> contêm os respectivos valores do teste de Ljung–Box para a maior ordem apresentada. Note que se você apenas quiser determinar a estatística <@mth="Q">, provavelmente você quererá usar a função <@xrf="ljungbox">. 

Menu path: /Variável/Correlograma
Other access: Menu de contexto da janela principal (selecção singular)

# cusum Tests

Options: 	<@lit="--squares"> (executa o teste CUSUMSQ)
		<@lit="--quiet"> (apenas mostra o teste Harvey–Collier)

Tem que se seguir à estimação de um modelo por via de OLS. Executa o teste CUSUM —ou se for dada a opção <@lit="--squares">, o teste CUSUMSQ —para a estabilidade dos parâmetros. É obtida uma série temporal de erros de predição um passo-à-frente, pela execução de séries de regressões: a primeira regressão usa as primeiras <@mth="k"> observações e é usada para gerar a predição da variável dependente na observação <@mth="k"> + 1; a segunda usa a primeira predição para a observação <@mth="k"> + 2, e por aí a diante (onde <@mth="k"> é o número de parâmetros no modelo original). 

A soma acumulada dos erros de predição escalados, ou os quadrados desses erros, é mostrada e apresentada em gráfico. A hipótese nula para a estabilidade dos parâmetros é rejeitada ao nível de cinco porcento, se a soma acumulada se desviar do intervalo de confiança de 95 porcento. 

No caso do teste CUSUM, é também apresentada a estatística de teste <@mth="t"> de Harvey–Collier, para a hipótese nula da estabilidade dos parâmetros. Ver o livro <@itl="Econometric Analysis"> de Greene para mais detalhes. Para o teste CUSUMSQ, o intervalo de confiança a 95 porcento é calculado de acordo com o algoritmo apresentado por <@bib="Edgerton e Wells (1994);edgerton94">. 

Menu path: Janela do modelo, /Testes/Teste CUSUM(SQ)

# data Dataset

Argument: 	<@var="lista-de-variáveis"> 
Options: 	<@lit="--compact">=<@var="method"> (specify compaction method)
		<@lit="--interpolate"> (do interpolation for low-frequency data)
		<@lit="--quiet"> (não reportar resultados exceto quando hajam erros)

Lê as variáveis indicadas na <@var="lista-de-variáveis"> a partir de uma base de dados (gretl, RATS 4.0 ou PcGive), que deve ter sido préviamente aberta usando o comando <@ref="open">. A frequência dos dados e o intervalo da amostra podem ser definidos pelos comandos <@ref="setobs"> e <@ref="smpl"> antes de usar este comando. Apresenta-se um exemplo completo: 

<code>          
   open macrodat.rat
   setobs 4 1959:1
   smpl ; 1999:4
   data GDP_JP GDP_UK
</code>

Os comandos acima abrem a base de dados com o nome <@lit="macrodat.rat">, definem um conjunto de dados trimestral iniciando no primeiro trimestre de 1959 e terminando no quarto trimestre de 1999, e depois importam as séries temporais com os nomes <@lit="GDP_JP"> e <@lit="GDP_UK">. 

Se os comandos <@lit="setobs"> e <@lit="smpl"> não tiverem sido especificados deste modo, a frequência dos dados e o intervalo da amostra serão definidos usando a primeira variável lida da base de dados. 

Se as séries temporais a serem lidas forem de frequência superior à do conjunto de dados em uso, você pode especificar um método de compactação tal como abaixo: 

<code>          
   data (compact=average) LHUR PUNEW
</code>

Os quatro métodos de compactação disponíveis são: Média; "average" (usa a média das observações de maior frequência), Último; "last" (usa a última observação), Primeiro; "first" e Soma; "sum". Se não tiver sido indicado nenhum métod, será usado a Média. 

If the series to be read are of lower frequency than the working dataset, the default is to repeat the values of the added data as required, but the <@opt="--⁠interpolate"> option can be used to request interpolation using the method of <@bib="Chow and Lin (1971);chowlin71">: the regressors are a constant and quadratic trend and an AR(1) disturbance process is assumed. Note, however, that this option is available only for conversion from quarterly data to monthly or annual data to quarterly. 

In the case of native gretl databases (only), the "glob" characters <@lit="*"> and <@lit="?"> can be used in <@var="varlist"> to import series that match the given pattern. For example, the following will import all series in the database whose names begin with <@lit="cpi">: 

<code>          
   data cpi*
</code>

Menu path: /Ficheiro/Bases de Dados

# dataset Dataset

Arguments: 	<@var="palavra-chave"> <@var="parâmetros"> 
Examples: 	<@lit="dataset addobs 24">
		<@lit="dataset insobs 10">
		<@lit="dataset compact 1">
		<@lit="dataset compact 4 last">
		<@lit="dataset expand interp">
		<@lit="dataset transpose">
		<@lit="dataset sortby x1">
		<@lit="dataset resample 500">
		<@lit="dataset renumber x 4">
		<@lit="dataset clear">

Efectua diversas operações sobre o conjunto de dados como um todo, dependendo da <@var="palavra-chave">, que tem que ser <@lit="addobs">, <@lit="insobs">, <@lit="clear">, <@lit="compact">, <@lit="expand">, <@lit="transpose">, <@lit="sortby">, <@lit="dsortby">, <@lit="resample"> ou <@lit="renumber">. Nota: exceptuando <@lit="clear">, estas ações não estão disponíveis enquanto o conjunto de dados estiver subamostrado por seleção de casos com algum critério Booleano. 

<@lit="addobs">: Tem que ser seguida por um inteiro positivo. Acrescenta o número indicado de observações adicionais no final do conjunto de dados em uso. Essencialmente, isto é pretendido para efeitos de predição. Os valores na maior parte das variáveis no intervalo acrescentado, serão marcados como omissos, mas certas variáveis determinísticas são reconhecidas e extendidas, nomeadamente, uma tendência linear simples e variáveis periódicas auxiliares. 

<@lit="insobs">: Tem que ser seguida por um inteiro positivo que não seja maior que o número de observações atual. Inserte uma única observação na posição indicada. Todos os dados subsequentes são deslocados uma posição e o conjunto de dados fica extendido com mais uma observação. Todas as variáveis exceto a constante recebem um valor omisso na nova observação. Esta ação não está disponível para conjuntos de dados de painel. 

<@lit="clear">: Não necessita parâmetros. Limpa o conjunto de dados corrente, ficando gretl no seu estado "vazio" inicial. 

<@lit="compact">: Tem que ser seguida por um inteiro positivo representando uma nova frequência, que deve ser inferior à frequência atual (por exemplo, um valor 4 quando a frequência corrente é 12, indica a compactação de mensal para trimestral). Este comando apenas está disponível para séries temporais; ele compacta todas as séries temporais do conjunto de dados para a nova frequência. Pode ser dado um segundo parâmetro, nomeadamente um de <@lit="sum">, <@lit="first"> ou <@lit="last">, para especificar, respectivamente, compactação usando a soma dos valores de maior frequência, valores de ínicio e de fim de período. Por omissão é feita compactação por média. 

<@lit="expand">: Este comando está apenas disponível para séries temporais anuais ou trimestrais: dados anuais podem ser expandidos para trimestrais, e dados trimestrais para frequência mensal. Por omissão todas as séries temporais no conjunto de dados são preenchidas com repetição de valores existentes até atingirem a nova frequência, mas se tiver sido acrescentado o modificador <@lit="interp"> então as séries temporais serão expandidas usando a interpolação de Chow-Lin: os regressores são a constante e a tendência quadrada e é assumido um processo de perturbação AR(1). 

<@lit="transpose">: Não necessita parâmetros. Transpõe o conjunto de dados actual. Isto é, cada observação (linha) será tratada como uma variável (coluna), e cada variável como uma observação. Este comando pode ser útil se quando os dados tenham sido lidos a partir de uma origem externa em que as linhas da tabela de dados representam variáveis. 

<@lit="sortby">: É necessário o nome de uma lista ou de uma única série de dados. Se tiver sido dada uma série de dados, as observações em todas as variáveis do conjunto de dados são re-ordenadas por ordem crescente da série especificada. Se tiver sido dada uma lista, a ordenação é hierárquica: se as observações estiverem empatadas no que diz respeito à primeira variável chave então é usada a segunda chave para desempatar, e assim sucessivamente até que não haja empates ou se tenham esgotado as chaves. Note que este comando apenas está disponível para dados sem data. 

<@lit="dsortby">: Funciona como <@lit="sortby"> exceto que a re-ordenação é por ordem decrescente das séries chave. 

<@lit="resample">: Constrói um novo conjunto de dados por amostragem aleatória, com substituição das linhas do conjunto de dados corrente. Requer um argumento, designadamente o número de linhas a incluir. Este pode ser menor, igual ou maior que o número de observações nos dados originais. O conjunto de dados original pode ser obtido usando o comando <@lit="smpl full">. 

<@lit="renumber">: Requer o nome de uma de uma série seguido por um inteiro entre 1 e o número de séries no conjunto de dados menos 1. Move a série especificada para a posição indicada dentro do conjunto de dados, renumerando adequadamente as restantes séries. (A posição 0 está ocupada pela constante, que não pode ser movida.) 

Menu path: /Dados

# debug Programming

Argument: 	<@var="função"> 

Comando experimental para despiste de erros de programa ('debugger') em funções definidas pelo utilizador, disponível em programas de linha-de-comandos, gretlcli, e na consola do ambiente gráfico (GUI). O comando <@lit="debug"> deve ser utilizado antes da chamada da função, mas depois da definição desta. O efeito é de que a execução é suspensa quando a função é chamada e é activada uma linha de interação especial. 

Na linha de interação, você introduz <@lit="next"> para executar o comando seguinte dentro da função, ou <@lit="continue"> para permitir continuar a execução da função sem impedimentos. Estes comandos podem ser abreviados com <@lit="n"> e <@lit="c"> respetivamente. Você também pode interpôr uma instrução nesta linha de interação, por exemplo um comando <@lit="print"> para mostrar o valor atual de alguma variável de interesse. 

# delete Dataset

Variants: 	<@lit="delete"> <@var="lista-de-variáveis">
		<@lit="delete"> <@var="nome-de-variável">
		<@lit="delete --type="><@var="nome-de-tipo">
Option: 	<@lit="--db"> (apaga séries em base de dados)

Este comando é um destrutor geral para variáveis com nome (quer sejam séries, escalares, matrizes, texto, ou 'bundles'). Tem que ser usada com cuidado; não será peguntada nenhuma confirmação. 

No caso de uma série <@var="nome-de-variável"> pode tomar a forma de uma lista com nome, o que faz com que todas as séries nessa lista sejam apagadas, ou pode tomar a forma de uma lista explícita de séries por nome ou número ID. Note que quando você apaga séries, quaisquer séries com números ID superiores àquelas que estão na lista a apagar serão renumeradas. 

Se for dada a opção <@opt="--⁠db">, o comando apaga as séries listadas não do conjunto de dados atual mas de uma base de dados gretl, assumindo que a base de dados está aberta e que o utilizador tem permissão de escrita no ficheiro em questão. Ver também o comando <@ref="open">. 

Se tiver sido dada a opção <@opt="--⁠type"> ela terá de ser acompanhada por um dos seguintes nomes-de-tipo: <@lit="matrix"> (matriz), <@lit="bundle"> ('bundle'), <@lit="string"> (texto), <@lit="list"> (lista), ou <@lit="scalar"> (escalar). O efeito é o de apagar todas as variáveis do tipo dado. Neste caso (somente neste), não deve ser indicado o argumento <@var="nome-de-variável">. 

Menu path: Menu de contexto da janela principal (selecção singular)

# diff Transformations

Argument: 	<@var="lista-de-variáveis"> 

É obtida a primeira diferença de cada variável na <@var="lista-de-variáveis"> e o resultado é guardado numa nova variável com o prefixo <@lit="d_">. Portanto <@lit="diff x y"> cria as duas novas variáveis 

<mono>          
   d_x = x(t) - x(t-1)
   d_y = y(t) - y(t-1)
</mono>

Menu path: /Acrescentar/Primeiras diferenças das variáveis selecionadas

# difftest Tests

Arguments: 	<@var="variável1"> <@var="variável2"> 
Options: 	<@lit="--sign"> (Teste dos Sinais, por omissão)
		<@lit="--rank-sum"> (Teste ordinal da soma de Wilcoxon)
		<@lit="--signed-rank"> (Teste ordinal dos sinais de Wilcoxon)
		<@lit="--verbose"> (mostrar detalhes)

Realiza um teste não-paramétrico para a diferença entre duas populações ou grupos, o teste específico depende da opção selecionada. 

Com a opção <@opt="--⁠sign">, é executado o teste dos Sinais. Este teste baseia-se no facto de duas amostras <@mth="x"> e <@mth="y">, terem sido extraídas aleatóriamente de uma mesma distribuição, a probabilidade de <@mth="x"><@sub="i"> > <@mth="y"><@sub="i">, para cada observação <@mth="i">, deve ser igual a 0,5. A estatística de teste é <@mth="w">, o número de observações para as quais <@mth="x"><@sub="i"> > <@mth="y"><@sub="i">. Sob a hipótese nula de que segue uma distribuição Binomial com os parâmetros (<@mth="n">, 0,5), onde <@mth="n"> é o número de observações. 

Com a opção <@opt="--⁠rank-sum">, é executado o teste ordinal da soma de Wilcoxon. Este teste consiste em ordenar as observações de ambas as amostras conjuntamente, da menor para a maior, e depois determinar a soma das ordens de uma das amostras. As duas amostras não necessitam ser do mesmo tamanho, e se isso acontece então usa-se a de menor dimensão no cálculo da soma das ordens. Sob a hipótese nula de que as amostras terem sido extraídas de populações com a mesma mediana, a distribuição de probabilidade da soma das ordens pode ser determinada para quaisquer tamanhos das amostras; e para amostras consideravelmente grandes existe uma forte aproximação a uma distribuição Normal. 

Com a opção <@opt="--⁠signed-rank">, é executado o teste ordinal dos sinais de Wilcoxon. Este destina-se para pares de dados associados assim como, por exemplo, os valores das variáveis de uma amostra de indivíduos antes e depois de algum tratamento. O teste começa por encontrar as diferenças entre as observações emparelhadas, <@mth="x"><@sub="i"> – <@mth="y"><@sub="i">, ordenando estas diferenças por valor absoluto, e então atribuindo a cada par um posto com sinal, coincidindo o sinal com o sinal da diferença. De seguida é calculado o <@mth="W"><@sub="+">, que é a soma dos postos com sinal positivo. Tal como o teste ordinal da soma, esta estatística tem uma distribuição bem definida, sob a hipótese nula de que a diferença mediana é zero, que converge para a distribuição Normal em amostras de tamanho razoável. 

Para os testes de Wilcoxon, se a opção <@opt="--⁠verbose"> tiver sido dada então será mostrado as ordens. (Esta opção não tem efeito se tiver sido selecionado o teste dos Sinais.) 

# discrete Transformations

Argument: 	<@var="lista-de-variáveis"> 
Option: 	<@lit="--reverse"> (marca variáveis como sendo contínuas)

Marca cada variável em <@var="lista-de-variáveis"> como sendo discreta. Por omissão todas as variáveis são tratadas como sendo contínuas; ao marcar uma variável como sendo discreta afeta o modo como a variável é usada em diagramas de frequência, e também permite-lhe selecionar a variável para o comando <@ref="dummify">. 

Se a opção <@opt="--⁠reverse"> tiver sido dada, é feito o contrário; ou seja, as variáveis em <@var="lista-de-variáveis"> são marcadas como sendo contínuas. 

Menu path: /Variável/Editar caraterísticas

# dpanel Estimation

Argument: 	<@var="p"> ; <@var="variável-dependente"> <@var="variáveis-independentes"> [ ; <@var="instrumentos"> ] 
Options: 	<@lit="--quiet"> (não mostrar o modelo estimado)
		<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--two-step"> (efetuar estimação GMM de dois passos)
		<@lit="--system"> (acrescentar equações por níveis)
		<@lit="--time-dummies"> (acrescentar variáveis auxiliares tempo)
		<@lit="--dpdstyle"> (comportamento semelhante ao do pacote DPD do Ox)
		<@lit="--asymptotic"> (erros padrão assimptóticos não corrigidos)
Examples: 	<@lit="dpanel 2 ; y x1 x2">
		<@lit="dpanel 2 ; y x1 x2 --system">
		<@lit="dpanel {2 3} ; y x1 x2 ; x1">
		<@lit="dpanel 1 ; y x1 x2 ; x1 GMM(x2,2,3)">
		See also <@inp="bbond98.inp">

Efectua a estimação de modelos de dados de painel dinâmico (ou seja, modelos de painel que incluem um ou mais desfasamentos da variável dependente) usando os métodos GMM-DIF ou GMM-SYS. 

O parâmetro <@var="p"> representa a ordem de autoregressão para a variável dependente. Na forma mais simples esta é um valor escalar, mas este argumento pode ser uma matriz pré-definida, para especificar um conjunto (eventualmente descontínuo) de desfasamentos a serem usados. 

A variável dependente e os regressores devem ser dados na forma de níveis; eles serão automaticamente diferenciados (pois este estimador usa diferenciação para anular os efeitos individuais). 

O último campo (opcional) do comando é para especificar instrumentos. Se não tiver sido dado instrumentos, é assumido que todas as variáveis independentes são estritamente exógenas. Caso você especifique alguns intrumentos, deverá incluir na lista variáveis independentes estritamente exógenas. Para regressores pré-determinados, você pode usar a função <@lit="GMM"> para incluir a especificação de uma gama de desfasamentos numa forma bloco-diagonal. Isto está exemplificado no terceiro exemplo acima. O primeiro argumento de <@lit="GMM"> é o nome da variável em questão, o segundo é o desfasamento mínimo a ser usado como instrumento, e o terceiro é o desfasamento máximo. A mesma sintaxe pode ser utilizada na função <@lit="GMMlevel"> para especificar instrumentos do tipo GMM para as equações nos níveis. 

Por omissão são apresentados os resultados da estimação a um passo (juntamente com erros padrão robustos). Opcionalmente você pode selecionar a estimação a dois passos. Em ambos os casos são determinados os testes de autocorrelação de ordem 1 e 2, assim como o teste de Sargan para a sobre-identificação e o teste de Wald para a significância conjunta dos regressores. Note que neste modelo diferenciado a autocorrelação de primeira ordem não é um risco para a validade do modelo, mas a autocorrelação de segunda ordem viola as assunções estatísticas presentes. 

No caso da estimação em dois passos, os erros padrão são obtidos por omissão usando a correção de amostra-finita sugerida por <@bib="Windmeijer (2005);windmeijer05">. Os erros padrão assimptóticos associados ao estimador de dois passos, são em geral, considerados como um guia pouco fiável para inferência, mas se por alguma razão você desejar observá-los você pode usar a opção <@opt="--⁠asymptotic"> para desligar a correção de Windmeijer. 

Se tiver sido dada a opção <@opt="--⁠time-dummies">, uma conjunto de variáveis auxiliares tempo é acrescentado aos regressores especificados. O número de auxiliares é menos um que o número máximo de períodos usados na estimação, para assim se evitar a colinearidade exata com a constante. As variáveis auxiliares entram na forma diferenciada, exceto se tiver sido dada a opção <@lit="--dpdstyle">, entrando nesse caso por níveis. 

Para mais detalhes e exemplos, ver o <@pdf="the Gretl User's Guide">. 

Menu path: /Modelo/Painel/Modelo de painel dinâmico

# dummify Transformations

Argument: 	<@var="lista-de-variáveis"> 
Options: 	<@lit="--drop-first"> (omitir da codificação o menor valor)
		<@lit="--drop-last"> (omitir da codificação o maior valor)

Para cada uma das variáveis adequadas em <@var="lista-de-variáveis">, cria um conjunto de variáveis auxiliares codificando para os diferentes valores dessa variável. É adequado para as variáveis que tenham sido explícitamente marcadas como sendo discretas, ou aquelas que tomem uma quantidade razoavelmente pequena de valores todos eles "quase redondos" (múltiplos de 0,25). 

Por omissão é criada uma variável auxiliar para cada valor distinto na variável em questão. Por exemplo se uma variável discreta <@lit="x"> tiver 5 valores distintos, serão criadas 5 variáveis auxiliares e acrescentadas ao conjunto de dados, com os nomes, <@lit="Dx_1">, <@lit="Dx_2"> e por aí adiante. A primeira variável auxiliar terá o valor 1 para observações onde <@lit="x"> toma o seu valor mais pequeno, 0 caso contrário; a variável auxiliar seguinte terá o valor 1 quando <@lit="x"> toma o seu segundo valor mais pequeno, e por aí adiante. Se uma das opções <@opt="--⁠drop-first"> ou <@opt="--⁠drop-last"> tiver sido acrescentada, então o menor ou o maior valor de cada variável será omitido da codificação (o que pode ser útil para evitar a "armadilha das variáveis auxiliares"). 

Este comando também pode ser introduzido no contexto da especificação de uma regressão. Por exemplo, a linha seguinte especifica um modelo onde <@lit="y"> é regredido sobre o conjunto de variáveis auxiliares codificadas em <@lit="x">. (Neste contexto, as opções não podem ser passadas a <@lit="dummify">.) 

<code>          
   ols y dummify(x)
</code>

Other access: Main window pop-up menu (single selection)

# duration Estimation

Arguments: 	<@var="variável-dependente"> <@var="variáveis-independentes"> [ ; <@var="variável-censora"> ] 
Options: 	<@lit="--exponential"> (usar a distribuição exponencial)
		<@lit="--loglogistic"> (usar a distribuição log-logística)
		<@lit="--lognormal"> (usar a distribuição log-normal)
		<@lit="--medians"> (os valores ajustados são medianas)
		<@lit="--robust"> (erros padrão robustos (QML))
		<@lit="--cluster">=<@var="variável-agrupada"> (ver a explicação em <@ref="logit">)
		<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--verbose"> (mostrar detalhes das iterações)
Examples: 	<@lit="duration y 0 x1 x2">
		<@lit="duration y 0 x1 x2 ; cens">

Estima um modelo de duração: a variável dependente (que tem que ser positiva) representa a duração de algum tipo de estado num certo assunto, por exemplo a duração de episódios de desemprego para uma seção-cruzada de inquiridos. Por omissão é utilizada a distribuição de Weibull, mas é possível usar as distribuições exponencial, log-logística e a log-normal. 

Se alguma das medições de durações estiver censurada ('right-censored') (por exemplo, para um certo índividuo um episódio de desemprego não chegou ao fim dentro do período de observação) então você pode acrescentar como último argumento a <@var="variável-censora">, que é uma série na qual valores diferentes de zero indicam caso censurados. 

Por omissão os valores ajustados obtidos por intermédio do acessor <@lit="$yhat"> são as médias condicionadas das durações, mas se tiver sido dada a opção <@lit="--medians">, então <@lit="$yhat"> devolve as medianas condicionadas. 

Para mais detalhes ver <@pdf="the Gretl User's Guide">. 

Menu path: /Modelo/Modelos não-lineares/Dados de durações...

# elif Programming

Ver <@ref="if">. 

# else Programming

Ver <@ref="if">. Note que <@lit="else"> requer uma linha para ele mesmo, antes do comando condicional seguinte. Você pode juntar um comentário, como em 

<code>          
   else # Certo, fazer algo diferente
</code>

Mas não pode juntar a um comando, como em 

<code>          
   else x = 5 # Errado!
</code>

# end Programming

Termina diversos tipos de bloco de comandos. Por exemplo, <@lit="end system"> termina uma equação <@ref="system">. 

# endif Programming

Ver <@ref="if">. 

# endloop Programming

Marca o fim de um ciclo de comandos. Ver <@ref="loop">. 

# eqnprint Printing

Options: 	<@lit="--complete"> (Cria um documento completo)
		<@lit="--output">=<@var="nome-de-ficheiro"> (envia a saída para o ficheiro especificado)

Tem que ser invocado a seguir à estimação de um modelo. Mostra o modelo estimado na forma de uma equação LaTeX. Se o nome-de-ficheiro tiver sido especificado usando a opção <@lit="-f"> a saída é redirecionada para esse ficheiro, caso contrário vai para um ficheiro com o nome no formato <@lit="equation_N.tex">, onde <@lit="N"> é o número de modelos estimados até ao momento na sessão corrente. Ver também <@ref="tabprint">. 

Se a opção <@opt="--⁠complete"> tiver sido dada, o ficheiro LaTeX é um documento completo, pronto para ser processado; de outro modo ele terá que ser incluído num documento. 

Menu path: Janela do Modelo, /LaTeX

# equation Estimation

Arguments: 	<@var="variável-dependente"> <@var="variáveis-independentes"> 
Example: 	<@lit="equation y x1 x2 x3 const">

Especifica uma equação dentro de um sistema de equações (ver <@ref="system">). A sintaxe para especificar uma equação dentro de um sistema SUR é o mesmo que em, por exemplo, <@ref="ols">. Para uma equação dentro de um sistema de Mínimos Quadrados de Três-Fases você tanto pode (a) fornecer uma especificação de equação tipo OLS e dar uma lista comum de instrumentos usando o comando <@lit="instr"> (mais uma vez, ver <@ref="system">), ou (b) usar a mesma sintaxe de equação como para <@ref="tsls">. 

# estimate Estimation

Arguments: 	[ <@var="nome-do-sistema"> ] [ <@var="estimador"> ] 
Options: 	<@lit="--iterate"> (iterar até à convergência)
		<@lit="--no-df-corr"> (não usar correção de graus de liberdade)
		<@lit="--geomean"> (ver abaixo)
		<@lit="--quiet"> (não mostrar resultados)
		<@lit="--verbose"> (mostrar detalhes das iterações)
Examples: 	<@lit="estimate "Klein Model 1" method=fiml">
		<@lit="estimate Sys1 method=sur">
		<@lit="estimate Sys1 method=sur --iterate">

Chama a estimação de um sistema de equações, que foi previamente definido usando o comando <@ref="system">. O nome do sistema deve ser dado em primeiro lugar, dentro de aspas caso contenha espaços. O estimador, que tem que ser um de <@lit="ols">, <@lit="tsls">, <@lit="sur">, <@lit="3sls">, <@lit="fiml"> ou <@lit="liml">, é precedido pelo texto <@lit="method=">. Estes argumentos são opcionais se o sistema em questão já foi estimado e ocupa a posição do "último modelo"; nesse caso o estimador é o mesmo definido anteriormente. 

Se o sistema em questão tinha aplicado um conjunto de restrições (ver o comando <@ref="restrict">), a estimação estará sujeita às restrições especificadas. 

Se o método de estimação é <@lit="sur"> ou <@lit="3sls"> e a opção <@opt="--⁠iterate"> tiver sido dada, o estimador será iterado. No caso do SUR, se o procedimento convergir os resultados são estimativas de máxima vesrosimilhança. No entanto, a iteração de Mínimos Quadrados de Três-Fases, geralmente não converge para resultados de informação-completa de máxima verosimilhança. A opção <@opt="--⁠iterate"> é ignorada nos outros métodos de estimação. 

Se tiverem sido escolhidos os estimadores equação-a-equação <@lit="ols"> ou <@lit="tsls">, por omissão é aplicada uma correção dos graus de liberdade quando se calcula os erros padrão. Isto pode ser suprimido usando a opção <@opt="--⁠no-df-corr">. Esta opção não tem efeito nos outros estimadores; de qualquer modo não seria aplicada a correção de graus de liberdade. 

Por omissão, a equação usada no cálculo dos elementos da matriz de covariância das equações cruzadas é 

  <@fig="syssigma1">

Se tiver sido dada a opção <@opt="--⁠geomean">, a correção de graus de liberdade será aplicada: a equação é 

  <@fig="syssigma2">

onde os <@mth="k">s são o número de parâmetros independentes em cada equação. 

Se tiver sido dada a opção <@opt="--⁠verbose"> e ter sido especificado um método iterativo, serão mostrados os detalhes das iterações. 

# eval Utilities

Argument: 	<@var="expression"> 
Examples: 	<@lit="eval x">
		<@lit="eval inv(X'X)">
		<@lit="eval sqrt($pi)">

This command makes gretl act like a glorified calculator. The program evaluates <@var="expression"> and prints its value. The argument may be the name of a variable, or something more complicated. In any case, it should be an expression which could stand as the right-hand side of an assignment statement. 

# fcast Prediction

Arguments: 	[ <@var="observações-iniciais observações-finais"> ] [ <@var="passos-à-frente"> ] [ <@var="nome-de-variável"> ] 
Options: 	<@lit="--dynamic"> (criar predição dinâmica)
		<@lit="--static"> (criar predição estática)
		<@lit="--out-of-sample"> (gerar predição fora-da-amostra)
		<@lit="--no-stats"> (não mostrar estatísticas de predição)
		<@lit="--quiet"> (não mostrar nada)
		<@lit="--rolling"> (ver abaixo)
		<@lit="--plot">[=<@var="nome-de-ficheiro">] (ver abaixo)
Examples: 	<@lit="fcast 1997:1 2001:4 f1">
		<@lit="fcast fit2">
		<@lit="fcast 2004:1 2008:3 4 rfcast --rolling">

Tem que se seguir a um comando de estimação. A predições são geradas para um certo intervalo de observações: se tiverem sido dados <@var="observações-iniciais"> e <@var="observações-finais">, para esse intervalo (se possível); caso contrário se a opção <@opt="--⁠out-of-sample"> tiver sido dada, para observações a seguir ao intervalo onde o modelo foi estimado; caso contrário pelo intervalo de amostragem corrente. Se uma predição fora-da-amostra for pedida mas não haja observações relevantes, será assinalado um erro. Dependendo da natureza do modelo, poderão ser gerados erros padrão; ver abaixo. Ver também abaixo o efeito especial da opção <@opt="--⁠rolling">. 

Se o último modelo estimado é de uma única equação, então o argumento opcional <@var="nome-de-variável"> tem o seguinte efeito: o valores preditos não são mostrado, mas guardados dentro do conjunto de dados no nome fornecido. Se o último modelo estimado é um sistema de equações, <@var="nome-de-variável"> tem um efeito diverente, nomeadamente a seleção de uma variável endógena específica para a predição (por omissão são produzidas predições para todas as variáveis endógenas). No caso do sistema, ou se não tiver sido dado o <@var="nome-de-variável">, os valores de predição podem ser obtidos usando o acessor <@lit="$fcast">, e os erros padrão, se disponíveis, pelo <@lit="$fcerr">. 

A escolha entre predições estáticas ou dinâmicas aplica-se apenas no caso de modelos dinâmicos, com processamento autoregressivo de erros ou que incluam um ou mais valores desfasados da variável dependente como regressores. As predições estáticas são um passo à frente, baseadas em valores concretizados no período anterior, enquanto que as predições dinâmicas usam a regra de encadeamento de predição. Por exemplo, se uma predição de <@mth="y"> em 2008 requer como entrada um valor de <@mth="y"> em 2007, uma predição estática é impossível sem dados reais para 2007. Uma predição dinâmica para 2008 é possível se uma predição anterior poder ser substítuida no <@mth="y"> em 2007. 

Por omissão o normal é produzir uma predição estática para alguma parte do intervalo de predição que abrange o intervalo da amostra onde o modelo foi estimado, e uma predição dinâmica (se relevante) para fora-da-amostra. A opção <@lit="dynamic"> chama uma predição dinâmica a partir da date mais cedo possível, e a opção <@opt="--⁠static"> chama uma predição estática até para fora-da-amosta. 

A opção <@opt="--⁠rolling"> está atualmente apenas disponível para modelos de um única equação estimados por Mínimos Quadrados (OLS). Quando esta opção é dada as predições são recursivas. Isto é, cada predição é gerada a partir de uma estimativa do modelo dado usando dados de uma ponto de partida fixo (nomeadamente, a partir do início do intervalo da amostra da estimação original) até à data de predição menos <@mth="k">, onde <@mth="k"> é o número de passos à frente que têm que ser dados no argumento <@var="passos-à-frente">. As predições serão sempre dinâmicas se isso for aplicável. Note que o argumento <@var="passos-à-frente"> deve ser dado apenas em conjunto com a opção <@opt="--⁠rolling">. 

A opção <@opt="--⁠plot"> (disponível apenas no caso de estimação de equação única) invoca a produção de um ficheiro de gráfico, que contém a representação gráfica da predição. Quando não é dado o parâmetro <@var="nome-de-ficheiro">, gretl escreve os comandos gnuplot para um ficheiro com nomes do tipo <@lit="gpttmp01.plt"> na diretoria de trabalho de gretl do utilizador (com o número incrementado em gráficos sucessivos). Se o <@var="nome-de-ficheiro"> é acrescentado, a sua extensão é usada para determinar o tipo de ficheiro a ser escrito (<@lit=".eps"> para EPS, <@lit=".pdf"> para PDF, ou <@lit=".png"> para PNG; qualquer outra extensão resulta num ficheiro de comandos gnuplot). Por exemplo, 

<code>          
   fcast --plot=fc.pdf
</code>

produzirá um gráfico em formato PDF. Serão respeitados caminhos completos para ficheiros, senão os ficheiros são escritos na diretoria de trabalho do gretl. 

A natureza dos erros padrão de predição (se disponíveis) depende da natureza do modelo e da predição. Para modelos lineares estáticos os erros padrão são determinados usando o método traçado por <@bib="Davidson e MacKinnon (2004);davidson-mackinnon04">; eles incorporam tanto a incerteza devida aos processos de erro como a incerteza dos parâmetros ( resumidos na matriz de covariância das estimativas dos parâmetros). Para modelos dinâmicos, os erros padrão de predição são apenas calculados no caso de uma predição dinâmica, e eles não incorporam incerteza de parâmetros. Para modelos não-lineares, os erros padrão de predição não estão disponíveis atualmente. 

Menu path: Janela de Modelo, /Análise/Predições...

# flush Programming

This simple command (no arguments, no options) is intended for use in time-consuming scripts that may be executed via the gretl GUI (it is ignored by the command-line program), to give the user a visual indication that things are moving along and gretl is not "frozen". 

Ordinarily if you launch a script in the GUI no output is shown until its execution is completed, but the effect of invoking <@lit="flush"> is as follows: 

<indent>
• On the first invocation, gretl opens a window, displays the output so far, and appends the message "Processing...". 
</indent>

<indent>
• On subsequent invocations the text shown in the output window is updated, and a new "processing" message is appended. 
</indent>

When execution of the script is completed any remaining output is automatically flushed to the text window. 

Please note, there is no point in using <@lit="flush"> in scripts that take less than (say) 5 seconds to execute. Also note that this command should not be used at a point in the script where there is no further output to be printed, as the "processing" message will then be misleading to the user. 

The following illustrates the intended use of <@lit="flush">: 

<code>          
       set echo off
       scalar n = 10
       loop i=1..n
           # do some time-consuming operation
           loop 100 --quiet
               a = mnormal(200,200)
               b = inv(a)
           endloop
           # print some results
           printf "Iteration %2d done\n", i
           if i < n
               flush
           endif
       endloop
</code>

# foreign Programming

Syntax: 	<@lit="foreign language="><@var="linguagem">
Options: 	<@lit="--send-data"> (pré-carregar o conjunto de dados corrente; ver abaixo)
		<@lit="--quiet"> (suprimir a saída do programa estrangeiro)

Este comando inicia um modo especial no qual se aceita os comandos a serem executados por outro programa. Você sai deste modo com <@lit="end foreign">; onde neste ponto são executados os comandos acumulados. 

Presentemente são suportados três programas "estrangeiros", GNU R (<@lit="language=R">), Ox de Jurgen Doornik (<@lit="language=Ox">) e GNU Octave (<@lit="language=Octave">). Os nomes de linguagem são reconhecidos sem considerar capitalização. 

A opção <@opt="--⁠send-data"> é válida apenas quando em ligação com R e Octave; tem o efeito de tornar o corrente conjunto de dados de gretl disponível dentro do programa alvo, usando o nome <@lit="gretldata">. 

<code>          
   list Rlist = x1 x2 x3
   foreign language=R --send-data=Rlist
</code>

Para detalhes e exemplos ver <@pdf="the Gretl User's Guide">. 

# fractint Statistics

Arguments: 	<@var="série"> [ <@var="ordem"> ] 
Options: 	<@lit="--gph"> (fazer o teste de Geweke e Porter-Hudak)
		<@lit="--all"> (fazer ambos os testes)
		<@lit="--quiet"> (não mostrar resultados)

Testa a integração fracional sobre a série especificada ("memória longa"). A hipótese nula é de que a ordem de integração da série é zero. Por omissão é usado o estimador local de Whittle <@bib="(Robinson, 1995);robinson95"> mas se tiver sido dada a opção <@opt="--⁠gph"> será usado o teste GPH <@bib="(Geweke e Porter-Hudak, 1983);GPH83">. Se a opção <@opt="--⁠all"> for dada então serão mostrados os resultados dos dois testes. 

Para mais detalhes sobre este tipo de testes, ver <@bib="Phillips e Shimotsu (2004);phillips04">. 

Se não tiver sido dado o argumento opcional <@var="ordem">, a ordem para os teste(s) é automaticamente definida como sendo o menor de <@mth="T">/2 e <@mth="T"><@sup="0.6">. 

Os resultados podem ser obtidos usando os acessores <@lit="$test"> e <@lit="$pvalue">. Estes valores baseiam-se no estimador local de Whittle exceto quando dada a opção <@opt="--⁠gph">. 

Menu path: /Variável/Testes de raiz unitária/Integração fracional

# freq Statistics

Argument: 	<@var="variável"> 
Options: 	<@lit="--nbins">=<@var="n"> (especificar o número de classes)
		<@lit="--min">=<@var="valor-mínimo"> (especificar o mínimo, ver abaixo)
		<@lit="--binwidth">=<@var="amplitude"> (especificar a amplitude das classes, ver abaixo)
		<@lit="--quiet"> (não mostrar o gráfico)
		<@lit="--normal"> (testar a distribuição normal)
		<@lit="--gamma"> (testar a distribuição gama)
		<@lit="--silent"> (não mostrar nada)
		<@lit="--show-plot"> (ver abaixo)
		<@lit="--matrix">=<@var="nome"> (usar coluna da matriz indicada)
Examples: 	<@lit="freq x">
		<@lit="freq x --normal">
		<@lit="freq x --nbins=5">
		<@lit="freq x --min=0 --binwidth=0.10">

Se não forem dadas opções, mostra a distribuição de frequência da série <@var="variável"> (dada por nome ou por número), com o número de classes e respetivo tamanho escolhidos automaticamente. 

Se tiver sido dada a opção <@opt="--⁠matrix">, a <@var="variável"> (que tem que ser um inteiro) será interpretada com um índice de base 1 que selecciona a coluna da matriz designada. 

Para controlar a apresentação da distribuição você pode especificar <@itl="tanto"> o número de classes ou o valor mínimo e ainda a amplitude das classes, tal como mostrado nos dois últimos exemplos acima. A opção <@opt="--⁠min"> define o limite inferior da classe mais à esquerda. 

Se a opção <@opt="--⁠normal"> tiver sido dada, será calculado o teste qui-quadrado para a normalidade de Doornik–Hansen. Se a opção <@opt="--⁠gamma"> tiver sido dada, o teste de normalidade será substituído pelo teste não paramétrico de Locke para a hipótese nula de que a variável segue uma distribuição gama; ver <@bib="Locke (1976);locke76">, <@bib="Shapiro e Chen (2001);shapiro-chen01">. Note que a parametrização da distribuição gama utilizadada em gretl é (forma, escala). 

Em modo interactivo, por omissão é apresentado o gráfico da distribuição. A opção <@opt="--⁠quiet"> pode ser usada para suprimir isto. Pelo contrário, normalmente não é mostrado o gráfico quando se usa a opção <@lit="freq"> dentro de uma sequência-de-comandos, mas você pode forçar que seja apresentado usando a opção <@opt="--⁠show-plot">. (Isto não se aplica quando se usa o programa em modo de linha-de-comandos, <@lit="gretlcli">.) 

A opção <@opt="--⁠silent"> suprime toda a saída do programa. Isto apenas faz sentido quando em conjunto com uma das opções de teste de distribuição: a estatística de teste e o seu valor p ficam guardados e podem ser obtidos usando os acessores <@lit="$test"> e <@lit="$pvalue">. 

Menu path: /Variável/Distribuição de frequência

# function Programming

Argument: 	<@var="nome-da-função"> 

Abre um bloco de declarações no qual é definida a função. Este bloco tem que ser finalizado com <@lit="end function">. Para mais detalhes ver <@pdf="the Gretl User's Guide">. 

# garch Estimation

Arguments: 	<@var="p"> <@var="q"> ; <@var="variável-dependente"> [ <@var="variáveis-independentes"> ] 
Options: 	<@lit="--robust"> (erros padrão robustos)
		<@lit="--verbose"> (mostrar detalhes das iterações)
		<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--nc"> (não incluir uma constante)
		<@lit="--stdresid"> (normalizar os resíduos)
		<@lit="--fcp"> (usar o algoritmo Fiorentini, Calzolari, Panattoni)
		<@lit="--arma-init"> (parâmetros iniciais da variância a partir de ARMA)
Examples: 	<@lit="garch 1 1 ; y">
		<@lit="garch 1 1 ; y 0 x1 x2 --robust">

Estima um modelo GARCH (GARCH = Autoregressivo Generalizado de Heterocedastidade Condicional, "Generalized Autoregressive Conditional Heteroskedasticity"), que pode ser um modelo univariado, ou multivariado se especificadas as <@var="variáveis-independentes">, incluindo as variáveis exógenas. Os valores inteiros <@var="p"> e <@var="q"> (que podem ser dados na forma numérica ou como nomes de variáveis escalares pré-existentes) representam as ordens de desfasamento na equação de variância condicional: 

  <@fig="garch_h">

Portanto, o parâmetro <@var="p"> representa a ordem Generalizada (ou "AR"), enquanto <@var="q"> representa a ordem normal ARCH (ou "MA"). Se <@var="p"> for não-nulo, <@var="q"> tem também que ser não-nulo senão o modelo fica não-identificado. No entanto, você pode estimar um modelo ARCH normal ao definir <@var="q"> para um valor positivo e <@var="p"> para zero. A soma de <@var="p"> e <@var="q"> não pode ser maior que 5. Note que é automaticamente incluida uma constante na equação da média, exceto se tiver sido dada a opção <@opt="--⁠nc">. 

Por omissão a estimação de modelos GARCH é feita usando código nativo gretl, mas você também tem a possibilidade de usar o algoritmo de <@bib="Fiorentini, Calzolari e Panattoni (1996);fiorentini96">. O primeiro usa o maximizador BFGS enquanto o segundo usa a matriz de informação para maximizar a verosimilhança, com aperfeiçoamento por via da Hessiana. 

Para este comando estão disponíveis diferentes estimadores da matriz de covariância. Por omissão, usa-se a Hessiana, ou se a opção <@opt="--⁠robust"> tiver sido dada, será usada a matriz de covariança QML (White). Outras possibilidades podem ser especificadas usando o comando <@ref="set"> (por exemplo a matriz de informação, ou o estimador Bollerslev–Wooldridge ). 

Por omissão, as estimativas dos parâmetros da variância são inicializados usando a variância do erro incondicional da estimação OLS inicial para a constante, e pequenos valores positivos para os coeficientes dos valores anteriores do quadrado do erro e da variância do erro. A opção <@opt="--⁠arma-init"> faz com que os valores iniciais destes parâmetros sejam definidos usando inicialmente um modelo ARMA, explorando a relação entre GARCH e ARMA demosntrado no Capítulo 21 do livro de Hamilton, <@itl="Time Series Analysis">. Em alguns casos isto pode melhorar as possibilidades de converência. 

Os resíduos GARCH e a variância condicional estimada podem ser obtidos como <@lit="$uhat"> e <@lit="$h"> respectivamente. Por exemplo, para obter a variância condicional: 

<code>          
   genr ht = $h
</code>

Se a opção <@opt="--⁠stdresid"> tiver sido dada, os valores <@lit="$uhat"> são divididos pela raiz quadrada de <@mth="h"><@sub="t">. 

Menu path: /Modelo/Série temporal/GARCH

# genr Dataset

Arguments: 	<@var="nova-variável"> <@var="= expressão"> 

NOTE: this command has undergone numerous changes and enhancements since the following help text was written, so for comprehensive and updated info on this command you'll want to refer to <@pdf="the Gretl User's Guide">. On the other hand, this help does not contain anything actually erroneous, so take the following as "you have this, plus more". 

No contexto apropriado, o nomes; <@lit="series">, <@lit="scalar"> e <@lit="matrix"> são sinónimos para este comando. 

Cria novas variáveis, frequentemente a partir de transformações de variáveis já existentes. Ver também os atalhos, <@ref="diff">, <@ref="logs">, <@ref="lags">, <@ref="ldiff">, <@ref="sdiff"> e <@ref="square">. No contexto de uma expressão <@lit="genr">, as variáveis existentes têm que ser referenciadas por nome e não por número ID. A expressão deve ser uma combinação bem construída de nomes de variáveis, constantes, operadores e funções (descrito adiante). Note que detalhes adicionais sobre alguns aspetos deste comando podem ser encontrados em <@pdf="the Gretl User's Guide">. 

Um comando <@lit="genr"> pode resultar tanto num escalar como numa série. Por exemplo, a expressão <@lit="x2 = x * 2"> naturalmente resulta numa série se a variável <@lit="x"> for uma série e num escalar se <@lit="x"> for um escalar. As expressões <@lit="x = 0"> e <@lit="mx = mean(x)"> naturalmente retornam escalares. Em alguma circusntâncias você poderá querer ter um resultado escalar expandido numa série ou num vetor. Você pode fazer isso usando <@lit="series"> como um "aliás" para o comando <@lit="genr">. Por exemplo, <@lit="series x = 0"> produz uma série em que todos os valores são 0. Você também pode usar <@lit="scalar"> como sendo um aliás para <@lit="genr">. Não é possível forçar um resultado do tipo vetor para um escalar mas o uso desta palavra reservada indica que o resultado <@itl="deve ser"> um escalar: se não for ocorrerá um erro. 

Quando uma expressão resulta numa série, o intervalo que será escrito na variável destino depende do actual intervalo de amostragem. É assim possível, definir uma série por troços usando o comando <@lit="smpl"> conjugado com <@lit="genr">. 

Os <@itl="operadores aritméticos"> suportados são, por ordem de precedência: <@lit="^"> (potenciação); <@lit="*">, <@lit="/"> e <@lit="%"> (resto da divisão inteira); <@lit="+"> e <@lit="-">. 

Os <@itl="operadores Booleanos"> são (mais uma vez, por ordem de precedência): <@lit="!"> (negação), <@lit="&&"> (E lógico), <@lit="||"> (OU lógico), <@lit=">">, <@lit="<">, <@lit="=">, <@lit=">="> (maior ou igual), <@lit="<="> (menor ou igual) e <@lit="!="> (diferente). Os operadores Booleanos podem ser usados na construção de variáveis auxiliares ('dummy'): por exemplo <@lit="(x > 10)"> retorna 1 se <@lit="x"> > 10, 0 caso contrário. 

As constantes pré-definidas são <@lit="pi"> e <@lit="NA">. Esta última representa um valor omisso: você pode inicializar uma variável como tendo um valor omisso com <@lit="scalar x = NA">. 

O comando <@lit="genr"> suporta uma larga gama de funções matemáticas e estatísticas, incluindo, para além das usuais, várias que são especialmente dedicadas à econometria. Adicionalmente oferece acesso a numerosas variáveis internas que são definidas no decorrer das regressões, testes de hipóteses e outros. Para uma lista de funções e acessores, ver <@gfr="the Gretl function reference">. 

Para além dos operadores e funções mencionados acima, existem alguns usos especiais de <@lit="genr">: 

<indent>
• <@lit="genr time"> cria uma variável de tendência temporal (1,2,3,…) com o nome <@lit="time">. <@lit="genr index"> faz a mesma coisa exceto em que o nome da variável é <@lit="index">. 
</indent>

<indent>
• <@lit="genr dummy"> cria variáveis auxiliares ('dummy') até à periodicidade dos dados. No caso de dados trimestrais (periodicidade 4), o programa cria <@lit="dq1"> = 1 para o primeiro trimestre 0 nos outros timestres, <@lit="dq2"> = 1 para o segundo trimestre e 0 para os outros trimestres, e por aí adiante. No caso de dados mensais as variáveis auxiliares têm os nomes <@lit="dm1">, <@lit="dm2">, e por aí adiante. No caso de outras frequências os nomes são <@lit="dummy_1">, <@lit="dummy_2">, etc. 
</indent>

<indent>
• <@lit="genr unitdum"> e <@lit="genr timedum"> criam conjuntos de variáveis auxiliares especiais para usar com dados de painel. O primeiro codifica para as seções-cruzadas e o segundo para os períodos temporais das observações. 
</indent>

<@itl="Nota">: No programa de linha-de-comandos, os comandos <@lit="genr"> que obtenham dados de modelo referem-se sempre ao modelo que foi estimado mais recentemente. Isto também é válido para o programa em ambiente gráfico (GUI), ao se usar <@lit="genr"> na "consola gretl" ou ao introduzir uma expressão usando "Definir nova variável" no menu Acrescentar na janela principal. No entanto, no GUI, você tem a possibilidade de obter dados a partir de qualquer modelo que esteja disponível numa janela (independentemente se é ou não o modelo mais recente). Isso é feito no menu "Gravar" na janela do modelo. 

A variável especial <@lit="obs"> serve como um índice das observações. Por exemplo <@lit="genr dum = (obs=15)"> irá gerar uma variável auxiliar que tem valor 1 para a observação 15 e 0 para as outras. Você também pode usar esta variável para escolher certas observações por data ou nome. Por exemplo, <@lit="genr d = (obs>1986:4)">, <@lit="genr d = (obs>"2008/04/01")">, ou <@lit="genr d = (obs="CA")">. Se se usarem datas diárias ou etiquetas neste contexto, elas devem ser indicadas dentro de aspas. Datas trimestrais ou mensais (com um dois-pontos) podem ser usadas sem aspas. Note que no caso de dados de séries temporais anuais, o ano não se distingue sintáticamente de um simples inteiro; como tal, se você quiser comparar observações com <@lit="obs"> por ano, você tem que usar a função <@lit="obsnum"> para converter o ano para um valor de índice iniciado em 1, tal como em <@lit="genr d = (obs>obsnum(1986))">. 

Valores escalares podem ser extraídos de uma série no contexto de uma expressão <@lit="genr">, usando a sintaxe <@var="varname"><@lit="["><@var="obs"><@lit="]">. O valor <@var="obs"> pode ser dado por núnmero ou data. Exemplos: <@lit="x[5]">, <@lit="CPI[1996:01]">. Para dados diários, deve se usar a forma <@var="YYYY/MM/DD">, por exemplo, <@lit="ibm[1970/01/23]">. 

Uma observação individual numa série pode ser modificado usando <@lit="genr">. Para fazer isto, uma observação válida numérica ou de data, tem que ser acrescentada dentro de parentesis rectos, ao nome da variável no lado esquerdo da expressão. Por exemplo, <@lit="genr x[3] = 30"> ou <@lit="genr x[1950:04] = 303.7">. 

Menu path: /Acrescentar/Definir nova variável
Other access: Menu de contexto da janela principal

# gmm Estimation

Options: 	<@lit="--two-step"> (estimação em duas fases)
		<@lit="--iterate"> (GMM iterado)
		<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--verbose"> (mostrar detalhes das iterações)
		<@lit="--lbfgs"> (usar L-BFGS-B em vez do normal BFGS)

Faz estimação usando o Método dos Momentos Generalizado, 'Generalized Method of Moments' (GMM) com o algoritmo BFGS (Broyden, Fletcher, Goldfarb, Shanno). Você tem que especificar um ou mais comandos para a atualização das quantidades relevantes (tipicamente os resíduos GMM), um ou mais conjuntos das condições, uma matriz inicial dos pesos, e uma listagem dos parâmetros a serem estimados, tudo entre os marcadores <@lit="gmm"> e <@lit="end gmm">. Quaisquer opções devem ser acrescentadas à linha <@lit="end gmm"> . 

Por favor veja mais detalhes sobre este comando em <@pdf="the Gretl User's Guide">. Aqui apenas ilustramos com um exemplo simples. 

<code>          
   gmm e = y - X*b
     orthog e ; W
     weights V
     params b
   end gmm
</code>

No exemplo acima nós assumimos que <@lit="y"> e <@lit="X"> são matrizes, <@lit="b"> é um vetor de tamanho apropriado dos valores dos parâmetros, <@lit="W"> é a matriz dos instrumentos, e <@lit="V"> é uma matriz adequada de pesos. A declaração 

<code>          
   orthog e ; W
</code>

indica que o vetor dos resíduos <@lit="e"> é em princípio ortognal a cada um dos instromentos que compõem as colunas de <@lit="W">. 

Menu path: /Modelo/GMM

# gnuplot Graphs

Arguments: 	<@var="variáveis-y"> <@var="variável-x"> [ <@var="variável-auxiliar"> ] 
Options: 	<@lit="--with-lines">[=<@var="especificação-de-variáveis">] (usar linhas, e não pontos)
		<@lit="--with-lp">[=<@var="especificação-de-variáveis">] (usar linhas e pontos)
		<@lit="--with-impulses">[=<@var="especificação-de-variáveis">] (usar linhas verticais)
		<@lit="--time-series"> (gráfico temporal)
		<@lit="--suppress-fitted"> (não mostrar a linha ajustada)
		<@lit="--single-yaxis"> (forçar o uso de apenas um eixo y)
		<@lit="--linear-fit"> (mostrar o ajustamento por mínimos quadrados)
		<@lit="--inverse-fit"> (mostrar o ajustamento inverso)
		<@lit="--quadratic-fit"> (mostrar o ajustamento quadrático)
		<@lit="--cubic-fit"> (mostrar o ajustamento cúbico)
		<@lit="--loess-fit"> (mostrar o ajustamento loess)
		<@lit="--semilog-fit"> (mostrar o ajustamento semilog)
		<@lit="--dummy"> (ver abaixo)
		<@lit="--matrix">=<@var="nome"> (representar as colunas da matriz indicada)
		<@lit="--output">=<@var="nome-de-ficheiro"> (enviar a saída para o ficheiro especificado)
		<@lit="--input">=<@var="nome-de-ficheiro"> (obter entrada a partir do ficheiro especificado)
Examples: 	<@lit="gnuplot y1 y2 x">
		<@lit="gnuplot x --time-series --with-lines">
		<@lit="gnuplot wages educ gender --dummy">
		<@lit="gnuplot y x --fit=quadratic">
		<@lit="gnuplot y1 y2 x --with-lines=y2">

As variáveis na lista <@var="variáveis-y"> são representadas contra a <@var="variável-x">. Para um gráfico de série temporal você pode indicar <@lit="tempo"> como sendo a <@var="variável-x"> ou usar a opção <@opt="--⁠time-series">. 

Por omissão os dados são representados como pontos; isto pode ser alterado com o uso de uma das opções <@opt="--⁠with-lines">, <@opt="--⁠with-lp"> ou <@opt="--⁠with-impulses">. Se for representada mais que uma variável no eixo dos <@mth="y">, o efeito destas opções pode ficar confinada a uma subconjunto de variáveis usando o parâmetro <@var="especificação-de-variáveis">. Isto deve tomar a forma de uma lista separada por vírgulas dos nomes ou números das variáveis a serem representadas por linhas ou impulsos respetivamente. O último exemplo mostrado acima, mostra como fazer um gráfico de <@lit="y1"> e <@lit="y2"> contra <@lit="x">, de modo a que <@lit="y2"> é representada por uma linha, mas <@lit="y1"> é por pontos. 

Se a opção <@opt="--⁠dummy"> tiver sido indicada, terão que ser dadas exatamente três variáveis: uma única variável <@mth="y">, uma variável <@mth="x">, e uma variável <@var="variável-auxiliar">, uma variável discreta. O efeito é o de representar as <@var="variáveis-y"> contra <@var="variável-x"> com os pontos mostrados com diferentes cores dependendo do valor da <@var="variável-auxiliar"> na respectiva observação. 

Geralmente, as <@var="variáveis-y"> e <@var="variável-x"> referem-se a séries no conjunto de dados corrente (tanto referenciadas por nome como por número ID). Mas se o nome de uma matriz for indicado com a opção <@opt="--⁠matrix"> estes argumentos (que têm que ser dados como valores numéricos) indicam indices de colunas (iniciados em 1) para a matriz fornecida. Assim, por exemplo, se você quiser um gráfico X-Y da coluna 2 da matriz <@lit="M"> contra a coluna 1, você deve usar: 

<code>          
   gnuplot 2 1 --matrix=M
</code>

Em modo interativo o gráfico é apresentado imediatamente. Em modo de sequência de comandos o comportamento por omissão é o de criar um ficheiro de comandos gnuplot na directoria de trabalho do utilizador, com um nome seguindo o padrão <@lit="gpttmpN.plt">, iniciando com N = <@lit="01">. Os gráficos podem ser depois gerados usando o programa gnuplot (em MS Windows, wgnuplot). Este comportamento pode ser modificado com o uso da opção <@opt="--⁠output="><@var="nome-de-ficheiro">. Esta opção controla o nome do ficheiro usado, e ao mesmo tempo permite-lhe especificar um formato de saída de acordo com a extensão de três letras no nome do ficheiro, sendo: <@lit=".eps"> resultante na produção de um ficheiro 'Encapsulated PostScript' (EPS); <@lit=".pdf"> produz PDF; <@lit=".png"> produz no formato PNG, <@lit=".emf"> em formato EMF ('Enhanced MetaFile'), <@lit=".fig"> no formato Xfig, e <@lit=".svg"> para o formato SVG ('Scalable Vector Graphics'). Se usado o nome de ficheiro "<@lit="display">" o gráfico é apresentado no écran tal como em modo interativo. Se o nome de ficheiro tiver outra qualquer extensão que não as mencionadas, será escrito um ficheiro de comandos gnuplot. 

<indent>
• <@lit="linear">: show the OLS fit regardless of its level of statistical significance. 
</indent>

<indent>
• <@lit="none">: don't show any fitted line. 
</indent>

<indent>
• <@lit="inverse">, <@lit="quadratic">, <@lit="cubic">, <@lit="semilog"> or <@lit="linlog">: show a fitted line based on a regression of the specified type. By <@lit="semilog">, we mean a regression of log <@mth="y"> on <@mth="x">; the fitted line represents the conditional expectation of <@mth="y">, obtained by exponentiation. By <@lit="linlog"> we mean a regression of <@mth="y"> on the log of <@mth="x">. 
</indent>

<indent>
• <@lit="loess">: show the fit from a robust locally weighted regression (also is sometimes known as "lowess"). 
</indent>

As várias opções de "ajustamento" são aplicáveis apenas nos caso de gráficos de dispersão bivariados e nos de uma única série-temporal. O comportamento por omissão para um gráfico de dispersão é o de mostrar a linha de ajustamento de mínimos quadrados se e só se o coeficiente do declive fôr significativo num nível de 10 porcento. Se a opção <@opt="--⁠suppress"> tiver sido dada, não será mostrada a linha ajustada. O comportamento por omissão para um gráfico de série-temporal é o de não mostrar a linha de ajustamento. Se a opção <@opt="--⁠linear"> fôr dada, a linha mínimos quadrados será mostrada independentemente de ser significativa ou não. As outras opções de ajustamento (<@opt="--⁠inverse">, <@opt="--⁠quadratic">, <@opt="--⁠cubic">, <@opt="--⁠loess"> e <@opt="--⁠semilog">) produzem respetivamente um ajustamento inverso (regressão de <@mth="y"> sobre 1/<@mth="x">), um ajustamento quadrático, um ajustamento cúbico, um ajustamento loess e um ajustamento semilog. Loess (também por vezes chamado "lowess") é uma regressão robusta com pesos locais. Por semilog, nós designamos uma regressão do logaritmo de <@mth="y"> sobre <@mth="x"> (ou tempo); a linha ajustada representa o <@mth="y"> esperado condicionalmente, obtido por exponenciação. 

Uma outra opção está disponível para este comando: a seguir às especificações das variáveis a serem representadas e das opções (caso hajam), você pode acrescentar comandos gnuplot para controlar a aparência do gráfico (por exemplo, para definir o título e/ou as escalas dos eixos). Estes comandos devem ser colocados dentro de chavetas, e cada comando gnuplot tem que ser terminado com um ponto-e-vírgula. Um '\' pode ser usado para continuar uma conjunto de comandos gnuplot por mais que uma linha. Aqui está um exemplo da sintaxe: 

<@lit="{ set title 'O Meu Título'; set yrange [0:1000]; }"> 

Menu path: /Ver/Gráfico das variáveis
Other access: Menu de contexto na janela principal, botão de gráfico na barra de ferramentas

# graphpg Graphs

Variants: 	<@lit="graphpg add">
		<@lit="graphpg fontscale "><@var="value">
		<@lit="graphpg show">
		<@lit="graphpg free">
		<@lit="graphpg --output="><@var="filename">

A "página dos gráficos" de sessão apenas funcionará se você tiver instalado o sistema de produção de texto LaTeX, e puder gerar e visionar documentos PDF ou PostScript. 

Na janela de sessão por ícones, você pode arrastar até oito gráficos para dentro de um ícone de página de gráficos. Quando você fizer duplo-clique na página de gráficos (ou com o botão direito e selecionar "Mostrar"), será produzida uma página com os gráficos selecionados e apresentada no visionador adequado. A partir deste você poderá imprimir a página. 

Para limpar a página de gráficos, clicar com o botão direito no seu ícone e selecionar "Limpar". 

Note que em sistemas diferentes do MS Windows, você pode ter que ajustar as definições dos programas usados para visionar documentos PDF ou PostScript. Isso encontra-se dentro do separador "Programas" na janela de diálogo das Preferências do gretl (a partir do menu Ferramentas da janela principal). 

Também é possível trabalhar com a página de gráficos a partir se sequência de comandos, ou usando a consola (dentro do programa em ambiente gráfico). São suportados os seguintes comandos e opções: 

Para acrescentar um gráfico à página de gráficos, dê o comando <@lit="graphpg add"> depois de o ter gravado como um gráfico com nome, tal como 

<code>          
   grf1 <- gnuplot Y X
   graphpg add
</code>

Para ver a página de gráficos: <@lit="graphpg show">. 

Para limpar a página de gráficos: <@lit="graphpg free">. 

Para ajustar a escala da fonte usada na página de gráficos, use <@lit="graphpg fontscale"> <@var="escala">, onde <@var="escala"> é um multiplicador (com o valor 1,0 por omissão). Assim, para tornar a o fonte 50 porcento maior que a por inicial você pode 

<code>          
   graphpg fontscale 1.5
</code>

Para chamar a impressão da página de gráficos para um ficheiro, use a opção <@opt="--⁠output="> mais um nome de ficheiro; o nome do ficheiro deverá ter o sufixo "<@lit=".pdf">", "<@lit=".ps">" ou "<@lit=".eps">". Por exemplo: 

<code>          
   graphpg --output="meu_ficheiro.pdf"
</code>

Neste contexto, por omissão o resultado usa linhas coloridas; para usar padrões ponto/traço em vez de cores, você pode acrescentar a opção <@opt="--⁠monochrome">. 

# hausman Tests

Este teste apenas está disponível após e estimar um modelo de mínimos quadrados (OLS) usando dados de painel (ver também <@lit="setobs">). Ele testa o modelo de amostragem simples ("pooled") contra as alternativas principais, os modelos de efeitos fixos e efeitos aleatórios. 

O modelo de efeitos fixos permite variar a interseção da regressão ao longo das unidades de seção cruzada. Uma estatística teste-<@mth="F"> é apresentada segundo a hipótese nula de que as interseções não diferem. O modelo de efeitos aleatórios decompõe a variância dos resíduos em duas partes, uma parte específica à unidade de seção cruzada e outra específica para a observação em particular. (Este estimador pode ser calculado apenas se o número de unidades de seção cruzada nos dados exceder o número de parâmetros a serem estimados.) A estatística de teste Breusch–Pagan LM, testa a hipótese nula de que o estimador mínimos quadrados de amostragem ("pooled") é adequado em oposição ao da alternativa de efeitos aleatórios. 

O modelo mínimos quadrados de amostragem ("pooled") pode ser rejeitado contra ambas as alternativas, efeitos fixos e efeitos aleatórios. Desde que o erro específico por unidade ou por grupo seja não correlacionado com as variáveis independentes, o estimador de efeitos aleatórios é mais eficiente do que o estimador de efeitos fixos; caso contrário o estimador de efeitos aleatórios é inconsistente e o estimador de efeitos fixos será preferido. A hipótese nula para o teste de Hausman é de que o erro específico de grupo não é tão correlacionado (e como tal o modelo de efeitos aleatórios é preferível). Um valor p baixo para este teste conta contra o modelo de efeitos aleatórios e a favor do modelo de efeitos fixos. 

Menu path: Janela do modelo, /Testes/Diagnósticos de Painel

# heckit Estimation

Arguments: 	<@var="variável-dependente"> <@var="variáveis-independentes"> ; <@var="equação de seleção"> 
Options: 	<@lit="--quiet"> (suprimir a escrita de resultados)
		<@lit="--robust"> (erros padrão QML)
		<@lit="--two-step"> (efetuar estimação de dois passos)
		<@lit="--vcv"> (mostrar a matriz de covariância)
		<@lit="--verbose"> (mostrar saídas adicionais)
Examples: 	<@lit="heckit y 0 x1 x2 ; ys 0 x3 x4">
		See also <@inp="heckit.inp">

Seleção do modelo de tipo Heckman. Na especificação, a lista antes do ponto-e-vírgula representa a equação do resultado. A variável dependente na equação de seleção (<@lit="ys"> no exemplo acima) tem que ser uma variável binária. 

Por omissão, os parâmetros são estimados por máxima verosimilhança. A matriz de covariância dos parâmetros é calculada usando a inversão negativa da Hessiana. Se for desejável a estimação, de dois passos, use a opção <@opt="--⁠two-step">. Neste caso, a matriz de covariância dos parâmetros da equação resultante é adequadamente ajustada de acordo com <@bib="Heckman (1979);heckman79">. 

Repare que na estimação de Máxima Verosimilhança (ML) é usada uma aproximação numérica da Hessiana; isto pode levar a inexatidões na matriz de covariância estimada se a escala das variáveis explanatórias for para alguns dos coeficientes estimados muito pequena em valor absoluto. Este problema pode ser abordado em versões futuras; por agora, como solução temporária, pode-se re-escalar a variável ou variáveis explanatórias que estão a causar problemas. 

Menu path: /Modelo/Variável dependente limitada/Heckit...

# help Utilities

Variants: 	<@lit="help">
		<@lit="help functions">
		<@lit="help"> <@var="command">
		<@lit="help"> <@var="function">
Option: 	<@lit="--func"> (select functions help)

If no arguments are given, prints a list of available commands. If the single argument <@lit="functions"> is given, prints a list of available functions (see <@ref="genr">). 

<@lit="help"> <@var="command"> describes <@var="command"> (e.g. <@lit="help smpl">). <@lit="help"> <@var="function"> describes <@var="function"> (e.g. <@lit="help ldet">). Some functions have the same names as related commands (e.g. <@lit="diff">): in that case the default is to print help for the command, but you can get help on the function by using the <@opt="--⁠func"> option. 

Menu path: /Help

# hsk Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--no-squares"> (see below)
		<@lit="--vcv"> (print covariance matrix)

This command is applicable where heteroskedasticity is present in the form of an unknown function of the regressors which can be approximated by a quadratic relationship. In that context it offers the possibility of consistent standard errors and more efficient parameter estimates as compared with OLS. 

The procedure involves (a) OLS estimation of the model of interest, followed by (b) an auxiliary regression to generate an estimate of the error variance, then finally (c) weighted least squares, using as weight the reciprocal of the estimated variance. 

In the auxiliary regression (b) we regress the log of the squared residuals from the first OLS on the original regressors and their squares (by default), or just on the original regressors (if the <@opt="--⁠no-squares"> option is given). The log transformation is performed to ensure that the estimated variances are all non-negative. Call the fitted values from this regression <@mth="u"><@sup="*">. The weight series for the final WLS is then formed as 1/exp(<@mth="u"><@sup="*">). 

Menu path: /Model/Other linear models/Heteroskedasticity corrected

# hurst Statistics

Argument: 	<@var="series"> 

Calculates the Hurst exponent (a measure of persistence or long memory) for a time-series variable having at least 128 observations. 

The Hurst exponent is discussed by Mandelbrot. In theoretical terms it is the exponent, <@mth="H">, in the relationship 

  <@fig="hurst">

where RS is the "rescaled range" of the variable <@mth="x"> in samples of size <@mth="n"> and <@mth="a"> is a constant. The rescaled range is the range (maximum minus minimum) of the cumulated value or partial sum of <@mth="x"> over the sample period (after subtraction of the sample mean), divided by the sample standard deviation. 

As a reference point, if <@mth="x"> is white noise (zero mean, zero persistence) then the range of its cumulated "wandering" (which forms a random walk), scaled by the standard deviation, grows as the square root of the sample size, giving an expected Hurst exponent of 0.5. Values of the exponent significantly in excess of 0.5 indicate persistence, and values less than 0.5 indicate anti-persistence (negative autocorrelation). In principle the exponent is bounded by 0 and 1, although in finite samples it is possible to get an estimated exponent greater than 1. 

In gretl, the exponent is estimated using binary sub-sampling: we start with the entire data range, then the two halves of the range, then the four quarters, and so on. For sample sizes smaller than the data range, the RS value is the mean across the available samples. The exponent is then estimated as the slope coefficient in a regression of the log of RS on the log of sample size. 

Menu path: /Variable/Hurst exponent

# if Programming

Flow control for command execution. Three sorts of construction are supported, as follows. 

<code>          
   # simple form
   if condition
       commands
   endif
   # two branches
   if condition
       commands1
   else
       commands2
        endif
   # three or more branches
   if condition1
       commands1
   elif condition2
       commands2
   else
       commands3
   endif
</code>

<@var="condition"> must be a Boolean expression, for the syntax of which see <@ref="genr">. More than one <@lit="elif"> block may be included. In addition, <@lit="if"> … <@lit="endif"> blocks may be nested. 

# include Programming

Argument: 	<@var="filename"> 
Examples: 	<@lit="include myfile.inp">
		<@lit="include sols.gfn">

Intended for use in a command script, primarily for including definitions of functions. Executes the commands in <@var="filename"> then returns control to the main script. To include a packaged function, be sure to include the filename extension. 

See also <@ref="run">. 

# info Dataset

Prints out any supplementary information stored with the current datafile. 

Menu path: /Data/Dataset info
Other access: Data browser windows

# install Utilities

Argument: 	<@var="pkgname"> 
Options: 	<@lit="--local"> (install from local file)
		<@lit="--remove"> (see below)
		<@lit="--purge"> (see below)
Examples: 	<@lit="install armax">
		<@lit="install felogit.gfn">
		<@lit="install /path/to/myfile.gfn --local">
		<@lit="install http://foo.bar.net/gretl/myfile.gfn">

Installer for gretl function packages (<@lit="gfn"> or <@lit="zip"> files). 

If this command is given the "plain" name of a gretl function package (as in the first two examples) the action is to download the specified package from the gretl server and install it on the local machine. In this case it is not necessary to supply a filename extension. 

If the <@opt="--⁠local"> option is given, the <@var="pkgname"> argument should be the path to an uninstalled package file on the local machine, with the correct extension. The action is to copy the file into place (<@lit="gfn">), or unzip it into place (<@lit="zip">), "into place" meaning where the <@ref="include"> command will find it. 

When no option is given, if <@var="pkgname"> begins with <@lit="http://">, the effect is to download a package file from a specified server and install it locally. 

With the <@opt="--⁠remove"> or <@opt="--⁠purge"> option the inverse operation is performed; that is, an installed package is uninstalled. If just <@opt="--⁠remove"> is given, the specified package is unloaded from memory and is removed from the GUI menu to which it is attached, if any. If the <@opt="--⁠purge"> option is given then in addition to the actions just mentioned the package file is deleted. (If the package is installed in its own subdirectory, the whole subdirectory is deleted.) 

Menu path: /Tools/Function packages/On server

# intreg Estimation

Arguments: 	<@var="minvar"> <@var="maxvar"> <@var="indepvars"> 
Options: 	<@lit="--quiet"> (suppress printing of results)
		<@lit="--verbose"> (print details of iterations)
		<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (see <@ref="logit"> for explanation)
Examples: 	<@lit="intreg lo hi const x1 x2">
		See also <@inp="wtp.inp">

Estimates an interval regression model. This model arises when the dependent variable is imperfectly observed for some (possibly all) observations. In other words, the data generating process is assumed to be 

  <@mth="y* = x b + u">

but we only observe <@mth="m <= y* <= M"> (the interval may be left- or right-unbounded). Note that for some observations <@mth="m"> may equal <@mth="M">. The variables <@var="minvar"> and <@var="maxvar"> must contain <@lit="NA">s for left- and right-unbounded observations, respectively. 

The model is estimated by maximum likelihood, assuming normality of the disturbance term. 

By default, standard errors are computed using the negative inverse of the Hessian. If the <@opt="--⁠robust"> flag is given, then QML or Huber–White standard errors are calculated instead. In this case the estimated covariance matrix is a "sandwich" of the inverse of the estimated Hessian and the outer product of the gradient. 

Menu path: /Model/Limited dependent variable/Interval regression

# join Dataset

Arguments: 	<@var="filename"> <@var="varname"> 
Options: 	<@lit="--data">=<@var="column-name"> (see below)
		<@lit="--filter">=<@var="expression"> (see below)
		<@lit="--ikey">=<@var="inner-key"> (see below)
		<@lit="--okey">=<@var="outer-key"> (see below)
		<@lit="--aggr">=<@var="method"> (see below)
		<@lit="--tkey">=<@var="column-name,format-string"> (see below)
		<@lit="--verbose"> (report on progress)

This command imports a data series from the source <@var="filename"> (which must be either a delimited text data file or a "native" gretl data file) under the name <@var="varname">. For details please see <@pdf="the Gretl User's Guide">; here we just give a brief summary of the available options. 

The <@opt="--⁠data"> option can be used to specify the column heading of the data in the source file, if this differs from the name by which the data should be known in gretl. 

The <@opt="--⁠filter"> option can be used to specify a criterion for filtering the source data (that is, selecting a subset of observations). 

The <@opt="--⁠ikey"> and <@opt="--⁠okey"> options can be used to specify a mapping between observations in the current dataset and observations in the source data (for example, individuals can be matched against the household to which they belong). 

The <@opt="--⁠aggr"> option is used when the mapping between observations in the current dataset and the source is not one-to-one. 

The <@opt="--⁠tkey"> option is applicable only when the current dataset has a time-series structure. It can be used to specify the name of a column containing dates to be matched to the dataset and/or the format in which dates are represented in that column. 

See also <@ref="append"> for simpler joining operations. 

# kalman Estimation

Options: 	<@lit="--cross"> (allow for cross-correlated disturbances)
		<@lit="--diffuse"> (use diffuse initialization)

Opens a block of statements to set up a Kalman filter. This block should end with the line <@lit="end kalman">, to which the options shown above may be appended. The intervening lines specify the matrices that compose the filter. For example, 

<code>          
   kalman 
     obsy y
     obsymat H
     statemat F
     statevar Q
   end kalman
</code>

would set up a linear, time invariant state-space model with observation equation 

  <@fig="kalman1">

and state transition equation 

  <@fig="kalman2">

where <@mth="V(u) = Q">. 

More complex state-space models are handled via the additional keywords <@lit="obsx">, <@lit="obsxmat">, <@lit="obsvar">, <@lit="inistate">, <@lit="inivar"> and <@lit="stconst">. Please see <@pdf="the Gretl User's Guide"> for details. 

See also <@xrf="kfilter">, <@xrf="ksimul">, <@xrf="ksmooth">. 

# kpss Tests

Arguments: 	<@var="order"> <@var="varlist"> 
Options: 	<@lit="--trend"> (include a trend)
		<@lit="--seasonals"> (include seasonal dummies)
		<@lit="--verbose"> (print regression results)
		<@lit="--quiet"> (suppress printing of results)
		<@lit="--difference"> (use first difference of variable)
Examples: 	<@lit="kpss 8 y">
		<@lit="kpss 4 x1 --trend">

For use of this command with panel data please see the final section in this entry. 

Computes the KPSS test <@bib="(Kwiatkowski et al, Journal of Econometrics, 1992);KPSS92"> for stationarity, for each of the specified variables (or their first difference, if the <@opt="--⁠difference"> option is selected). The null hypothesis is that the variable in question is stationary, either around a level or, if the <@opt="--⁠trend"> option is given, around a deterministic linear trend. 

The <@var="order"> argument determines the size of the window used for Bartlett smoothing. If a negative value is given this is taken as a signal to use an automatic window size of 4(<@mth="T">/100)<@sup="0.25">, where <@mth="T"> is the sample size. 

If the <@opt="--⁠verbose"> option is chosen the results of the auxiliary regression are printed, along with the estimated variance of the random walk component of the variable. 

The critical values shown for the test statistic are based on response surfaces estimated in the manner set out by <@bib="Sephton (Economics Letters, 1995);sephton95">, which are more accurate for small samples than the values given in the original KPSS article. When the test statistic lies between the 10 percent and 1 percent critical values a p-value is shown; this is obtained by linear interpolation and should not be taken too literally. See the <@xrf="kpsscrit"> function for a means of obtaining these critical values programmatically. 

<@itl="Panel data"> 

When the <@lit="kpss"> command is used with panel data, to produce a panel unit root test, the applicable options and the results shown are somewhat different. While you may give a list of variables for testing in the regular time-series case, with panel data only one variable may be tested per command. And the <@opt="--⁠verbose"> option has a different meaning: it produces a brief account of the test for each individual time series (the default being to show only the overall result). 

When possible, the overall test (null hypothesis: the series in question is stationary for all the panel units) is calculated using the method of <@bib="Choi (Journal of International Money and Finance, 2001);choi01">. This is not always straightforward, the difficulty being that while the Choi test is based on the p-values of the tests on the individual series, we do not currently have a means of calculating p-values for the KPSS test statistic; we must rely on a few critical values. 

If the test statistic for a given series falls between the 10 percent and 1 percent critical values, we are able to interpolate a p-value. But if the test falls short of the 10 percent value, or exceeds the 1 percent value, we cannot interpolate and can at best place a bound on the global Choi test. If the individual test statistic falls short of the 10 percent value for some units but exceeds the 1 percent value for others, we cannot even compute a bound for the global test. 

Menu path: /Variable/Unit root tests/KPSS test

# labels Dataset

Variants: 	<@lit="labels ["> <@var="varlist"> <@lit="]">
		<@lit="labels --to-file="><@var="filename">
		<@lit="labels --from-file="><@var="filename">
		<@lit="labels --delete">

In the first form, prints out the informative labels (if present) for the series in <@var="varlist">, or for all series in the dataset if <@var="varlist"> is not specified. 

With the option <@opt="--⁠to-file">, writes to the named file the labels for all series in the dataset, one per line. If no labels are present an error is flagged; if some series have labels and others do not, a blank line is printed for series with no label. 

With the option <@opt="--⁠from-file">, reads the specified file (which should be plain text) and assigns labels to the series in the dataset, reading one label per line and taking blank lines to indicate blank labels. 

The <@opt="--⁠delete"> option does what you'd expect: it removes all the series labels from the dataset. 

Menu path: /Data/Variable labels

# lad Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Option: 	<@lit="--vcv"> (print covariance matrix)

Calculates a regression that minimizes the sum of the absolute deviations of the observed from the fitted values of the dependent variable. Coefficient estimates are derived using the Barrodale–Roberts simplex algorithm; a warning is printed if the solution is not unique. 

Standard errors are derived using the bootstrap procedure with 500 drawings. The covariance matrix for the parameter estimates, printed when the <@opt="--⁠vcv"> flag is given, is based on the same bootstrap. 

Menu path: /Model/Robust estimation/Least Absolute Deviation

# lags Transformations

Arguments: 	[ <@var="order"> ; ] <@var="laglist"> 
Examples: 	<@lit="lags x y">
		<@lit="lags 12 ; x y">

Creates new series which are lagged values of each of the series in <@var="varlist">. By default the number of lags created equals the periodicity of the data. For example, if the periodicity is 4 (quarterly), the command <@lit="lags x"> creates 

<mono>          
   x_1 = x(t-1)
   x_2 = x(t-2)
   x_3 = x(t-3)
   x_4 = x(t-4)
</mono>

The number of lags created can be controlled by the optional first parameter (which, if present, must be followed by a semicolon). 

Menu path: /Add/Lags of selected variables

# ldiff Transformations

Argument: 	<@var="varlist"> 

The first difference of the natural log of each series in <@var="varlist"> is obtained and the result stored in a new series with the prefix <@lit="ld_">. Thus <@lit="ldiff x y"> creates the new variables 

<mono>          
   ld_x = log(x) - log(x(-1))
   ld_y = log(y) - log(y(-1))
</mono>

Menu path: /Add/Log differences of selected variables

# leverage Tests

Options: 	<@lit="--save"> (save variables)
		<@lit="--quiet"> (don't print results)

Must follow an <@lit="ols"> command. Calculates the leverage (<@mth="h">, which must lie in the range 0 to 1) for each data point in the sample on which the previous model was estimated. Displays the residual (<@mth="u">) for each observation along with its leverage and a measure of its influence on the estimates, <@mth="uh">/(1 – <@mth="h">). "Leverage points" for which the value of <@mth="h"> exceeds 2<@mth="k">/<@mth="n"> (where <@mth="k"> is the number of parameters being estimated and <@mth="n"> is the sample size) are flagged with an asterisk. For details on the concepts of leverage and influence see <@bib="Davidson and MacKinnon (1993);davidson-mackinnon93">, Chapter 2. 

DFFITS values are also computed: these are "studentized residuals" (predicted residuals divided by their standard errors) multiplied by <@fig="dffit">. For discussions of studentized residuals and DFFITS see chapter 12 of <@bib="Maddala's Introduction to Econometrics;maddala92"> or <@bib="Belsley, Kuh and Welsch (1980);belsley-etal80">. 

Briefly, a "predicted residual" is the difference between the observed value of the dependent variable at observation <@mth="t">, and the fitted value for observation <@mth="t"> obtained from a regression in which that observation is omitted (or a dummy variable with value 1 for observation <@mth="t"> alone has been added); the studentized residual is obtained by dividing the predicted residual by its standard error. 

If the <@opt="--⁠save"> flag is given with this command, then the leverage, influence and DFFITS values are added to the current data set. In that context the <@opt="--⁠quiet"> flag may be used to suppress the printing of results. 

After execution, the <@lit="$test"> accessor returns the cross-validation criterion, which is defined as the sum of squared deviations of the dependent variable from its forecast value, the forecast for each observation being based on a sample from which that observation is excluded. (This is known as the <@itl="leave-one-out"> estimator). For a broader discussion of the cross-validation criterion, see Davidson and MacKinnon's <@itl="Econometric Theory and Methods">, pages 685–686, and the references therein. 

Menu path: Model window, /Tests/Influential observations

# levinlin Tests

Arguments: 	<@var="order"> <@var="series"> 
Options: 	<@lit="--nc"> (test without a constant)
		<@lit="--ct"> (with constant and trend)
		<@lit="--quiet"> (suppress printing of results)
Examples: 	<@lit="levinlin 0 y">
		<@lit="levinlin 2 y --ct">
		<@lit="levinlin {2,2,3,3,4,4} y">

Carries out the panel unit-root test described by <@bib="Levin, Lin and Chu (2002);LLC2002">. The null hypothesis is that all of the individual time series exhibit a unit root, and the alternative is that none of the series has a unit root. (That is, a common AR(1) coefficient is assumed, although in other respects the statistical properties of the series are allowed to vary across individuals.) 

By default the test ADF regressions include a constant; to suppress the constant use the <@opt="--⁠nc"> option, or to add a linear trend use the <@opt="--⁠ct"> option. (See the <@ref="adf"> command for explanation of ADF regressions.) 

The (non-negative) <@var="order"> for the test (governing the number of lags of the dependent variable to include in the ADF regressions) may be given in either of two forms. If a scalar value is given, this is applied to all the individuals in the panel. The alternative is to provide a matrix containing a specific lag order for each individual; this must be a vector with as many elements as there are individuals in the current sample range. Such a matrix can be specified by name, or constructed using braces as illustrated in the last example above. 

Menu path: /Variable/Unit root tests/Levin-Lin-Chu test

# logistic Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--ymax">=<@var="value"> (specify maximum of dependent variable)
		<@lit="--vcv"> (print covariance matrix)
Examples: 	<@lit="logistic y const x">
		<@lit="logistic y const x --ymax=50">

Logistic regression: carries out an OLS regression using the logistic transformation of the dependent variable, 

  <@fig="logistic1">

The dependent variable must be strictly positive. If all its values lie between 0 and 1, the default is to use a <@mth="y"><@sup="*"> value (the asymptotic maximum of the dependent variable) of 1; if its values lie between 0 and 100, the default <@mth="y"><@sup="*"> is 100. 

If you wish to set a different maximum, use the <@opt="--⁠ymax"> option. Note that the supplied value must be greater than all of the observed values of the dependent variable. 

The fitted values and residuals from the regression are automatically transformed using 

  <@fig="logistic2">

where <@mth="x"> represents either a fitted value or a residual from the OLS regression using the transformed dependent variable. The reported values are therefore comparable with the original dependent variable. 

Note that if the dependent variable is binary, you should use the <@ref="logit"> command instead. 

Menu path: /Model/Limited dependent variable/Logistic

# logit Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (clustered standard errors)
		<@lit="--multinomial"> (estimate multinomial logit)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--verbose"> (print details of iterations)
		<@lit="--p-values"> (show p-values instead of slopes)

If the dependent variable is a binary variable (all values are 0 or 1) maximum likelihood estimates of the coefficients on <@var="indepvars"> are obtained via the Newton–Raphson method. As the model is nonlinear the slopes depend on the values of the independent variables. By default the slopes with respect to each of the independent variables are calculated (at the means of those variables) and these slopes replace the usual p-values in the regression output. This behavior can be suppressed my giving the <@opt="--⁠p-values"> option. The chi-square statistic tests the null hypothesis that all coefficients are zero apart from the constant. 

By default, standard errors are computed using the negative inverse of the Hessian. If the <@opt="--⁠robust"> flag is given, then QML or Huber–White standard errors are calculated instead. In this case the estimated covariance matrix is a "sandwich" of the inverse of the estimated Hessian and the outer product of the gradient; see chapter 10 of <@bib="Davidson and MacKinnon (2004);davidson-mackinnon04">. But if the <@opt="--⁠cluster"> option is given, then "cluster-robust" standard errors are produced; see <@pdf="the Gretl User's Guide"> for details. 

If the dependent variable is not binary but is discrete, then by default it is interpreted as an ordinal response, and Ordered Logit estimates are obtained. However, if the <@opt="--⁠multinomial"> option is given, the dependent variable is interpreted as an unordered response, and Multinomial Logit estimates are produced. (In either case, if the variable selected as dependent is not discrete an error is flagged.) In the multinomial case, the accessor <@lit="$mnlprobs"> is available after estimation, to get a matrix containing the estimated probabilities of the outcomes at each observation (observations in rows, outcomes in columns). 

If you want to use logit for analysis of proportions (where the dependent variable is the proportion of cases having a certain characteristic, at each observation, rather than a 1 or 0 variable indicating whether the characteristic is present or not) you should not use the <@lit="logit"> command, but rather construct the logit variable, as in 

<code>          
   series lgt_p = log(p/(1 - p))
</code>

and use this as the dependent variable in an OLS regression. See chapter 12 of <@bib="Ramanathan (2002);ramanathan02">. 

Menu path: /Model/Limited dependent variable/Logit

# logs Transformations

Argument: 	<@var="varlist"> 

The natural log of each of the series in <@var="varlist"> is obtained and the result stored in a new series with the prefix <@lit="l_"> ("el" underscore). For example, <@lit="logs x y"> creates the new variables <@lit="l_x"> = ln(<@lit="x">) and <@lit="l_y"> = ln(<@lit="y">). 

Menu path: /Add/Logs of selected variables

# loop Programming

Argument: 	<@var="control"> 
Options: 	<@lit="--progressive"> (enable special forms of certain commands)
		<@lit="--verbose"> (report details of genr commands)
		<@lit="--quiet"> (do not report number of iterations performed)
Examples: 	<@lit="loop 1000">
		<@lit="loop 1000 --progressive">
		<@lit="loop while essdiff > .00001">
		<@lit="loop i=1991..2000">
		<@lit="loop for (r=-.99; r<=.99; r+=.01)">
		<@lit="loop foreach i xlist">

This command opens a special mode in which the program accepts commands to be executed repeatedly. You exit the mode of entering loop commands with <@lit="endloop">: at this point the stacked commands are executed. 

The parameter <@var="control"> may take any of five forms, as shown in the examples: an integer number of times to repeat the commands within the loop; "<@lit="while">" plus a boolean condition; a range of integer values for index variable; "<@lit="for">" plus three expressions in parentheses, separated by semicolons (which emulates the <@lit="for"> statement in the C programming language); or "<@lit="foreach">" plus an index variable and a list. 

See <@pdf="the Gretl User's Guide"> for further details and examples. The effect of the <@opt="--⁠progressive"> option (which is designed for use in Monte Carlo simulations) is explained there. Not all gretl commands may be used within a loop; the commands available in this context are also set out there. 

# mahal Statistics

Argument: 	<@var="varlist"> 
Options: 	<@lit="--quiet"> (don't print anything)
		<@lit="--save"> (add distances to the dataset)
		<@lit="--vcv"> (print covariance matrix)

Computes the Mahalanobis distances between the series in <@var="varlist">. The Mahalanobis distance is the distance between two points in a <@mth="k">-dimensional space, scaled by the statistical variation in each dimension of the space. For example, if <@mth="p"> and <@mth="q"> are two observations on a set of <@mth="k"> variables with covariance matrix <@mth="C">, then the Mahalanobis distance between the observations is given by 

  <@fig="mahal">

where (<@mth="p"> – <@mth="q">) is a <@mth="k">-vector. This reduces to Euclidean distance if the covariance matrix is the identity matrix. 

The space for which distances are computed is defined by the selected variables. For each observation in the current sample range, the distance is computed between the observation and the centroid of the selected variables. This distance is the multidimensional counterpart of a standard <@mth="z">-score, and can be used to judge whether a given observation "belongs" with a group of other observations. 

If the <@opt="--⁠vcv"> option is given, the covariance matrix and its inverse are printed. If the <@opt="--⁠save"> option is given, the distances are saved to the dataset under the name <@lit="mdist"> (or <@lit="mdist1">, <@lit="mdist2"> and so on if there is already a variable of that name). 

Menu path: /View/Mahalanobis distances

# makepkg Programming

Argument: 	<@var="filename"> 
Options: 	<@lit="--index"> (write auxiliary index file)
		<@lit="--translations"> (write auxiliary strings file)

Supports creation of a gretl function package via the command line. The mode of operation of this command depends on the extension of <@var="filename">, which must be either <@lit=".gfn"> or <@lit=".zip">. 

<@itl="Gfn mode"> 

Writes a gfn file. It is assumed that a package specification file, with the same basename as <@var="filename"> but with the extension <@lit=".spec">, is accessible, along with any auxiliary files that it references. It is also assumed that all the functions to be packaged have been read into memory. 

<@itl="Zip mode"> 

Writes a zip package file (gfn plus other materials). If a gfn file of the same basename as <@var="filename"> is found, it forms the basis of the zip package. If no gfn file is found, the program first attempts to build the gfn, as described above. 

<@itl="Gfn options"> 

The option flags support the writing of auxiliary files, intended for use with gretl "addons". The index file is a short XML document containing basic information about the package; it has the same basename as the package and the extension <@lit=".xml">. The translations file contains strings from the package that may be suitable for translation, in C format; for package <@lit="foo"> this file is named <@lit="foo-i18n.c">. These files are not produced if the command is operating in zip mode and a pre-existing gfn file is used. 

For details on all of this, see the the <@itl="Gretl Function Package Guide">. 

Menu path: /Tools/Function packages/New package

# markers Dataset

Variants: 	<@lit="markers --to-file="><@var="filename">
		<@lit="markers --from-file="><@var="filename">
		<@lit="markers --delete">

With the option <@opt="--⁠to-file">, writes to the named file the observation marker strings from the current dataset, one per line. If no such strings are present an error is flagged. 

With the option <@opt="--⁠from-file">, reads the specified file (which should be plain text) and assigns observation markers to the rows in the dataset, reading one marker per line. In general there should be at least as many markers in the file as observations in the dataset, but if the dataset is a panel it is also acceptable if the number of markers in the file matches the number of cross-sectional units (in which case the markers are repeated for each time period.) 

The <@opt="--⁠delete"> option does what you'd expect: it removes the observation marker strings from the dataset. 

Menu path: /Data/Observation markers

# meantest Tests

Arguments: 	<@var="series1"> <@var="series2"> 
Option: 	<@lit="--unequal-vars"> (assume variances are unequal)

Calculates the <@mth="t"> statistic for the null hypothesis that the population means are equal for the variables <@var="series1"> and <@var="series2">, and shows its p-value. 

By default the test statistic is calculated on the assumption that the variances are equal for the two variables. With the <@opt="--⁠unequal-vars"> option the variances are assumed to be different; in this case the degrees of freedom for the test statistic are approximated as per <@bib="Satterthwaite (1946);satter46">. 

Menu path: /Tools/Test statistic calculator

# mle Estimation

Arguments: 	<@var="log-likelihood function"> [ <@var="derivatives"> ] 
Options: 	<@lit="--quiet"> (don't show estimated model)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--hessian"> (base covariance matrix on the Hessian)
		<@lit="--robust"> (QML covariance matrix)
		<@lit="--verbose"> (print details of iterations)
		<@lit="--no-gradient-check"> (see below)
		<@lit="--lbfgs"> (use L-BFGS-B instead of regular BFGS)
Examples: 	<@inp="weibull.inp">

Performs Maximum Likelihood (ML) estimation using either the BFGS (Broyden, Fletcher, Goldfarb, Shanno) algorithm or Newton's method. The user must specify the log-likelihood function. The parameters of this function must be declared and given starting values (using the <@lit="genr"> command) prior to estimation. Optionally, the user may specify the derivatives of the log-likelihood function with respect to each of the parameters; if analytical derivatives are not supplied, a numerical approximation is computed. 

Simple example: Suppose we have a series <@lit="X"> with values 0 or 1 and we wish to obtain the maximum likelihood estimate of the probability, <@lit="p">, that <@lit="X"> = 1. (In this simple case we can guess in advance that the ML estimate of <@lit="p"> will simply equal the proportion of Xs equal to 1 in the sample.) 

The parameter <@lit="p"> must first be added to the dataset and given an initial value. For example, <@lit="scalar p = 0.5">. 

We then construct the MLE command block: 

<code>          
   mle loglik = X*log(p) + (1-X)*log(1-p)
     deriv p = X/p - (1-X)/(1-p)
   end mle
</code>

The first line above specifies the log-likelihood function. It starts with the keyword <@lit="mle">, then a dependent variable is specified and an expression for the log-likelihood is given (using the same syntax as in the <@lit="genr"> command). The next line (which is optional) starts with the keyword <@lit="deriv"> and supplies the derivative of the log-likelihood function with respect to the parameter <@lit="p">. If no derivatives are given, you should include a statement using the keyword <@lit="params"> which identifies the free parameters: these are listed on one line, separated by spaces and can be either scalars, or vectors, or any combination of the two. For example, the above could be changed to: 

<code>          
   mle loglik = X*log(p) + (1-X)*log(1-p)
     params p
   end mle
</code>

in which case numerical derivatives would be used. 

Note that any option flags should be appended to the ending line of the MLE block. 

By default, estimated standard errors are based on the Outer Product of the Gradient. If the <@opt="--⁠hessian"> option is given, they are instead based on the negative inverse of the Hessian (which is approximated numerically). If the <@opt="--⁠robust"> option is given, a QML estimator is used (namely, a sandwich of the negative inverse of the Hessian and the covariance matrix of the gradient). 

If you supply analytical derivatives, by default gretl runs a numerical check on their plausibility. Occasionally this may produce false positives, instances where correct derivatives appear to be wrong and estimation is refused. To counter this, or to achieve a little extra speed, you can give the option <@opt="--⁠no-gradient-check">. Obviously, you should do this only if you are quite confident that the gradient you have specified is right. 

For a much more in-depth description of <@lit="mle">, please refer to <@pdf="the Gretl User's Guide">. 

Menu path: /Model/Maximum likelihood

# modeltab Utilities

Variants: 	<@lit="modeltab add">
		<@lit="modeltab show">
		<@lit="modeltab free">
		<@lit="modeltab --output="><@var="filename">

Manipulates the gretl "model table". See <@pdf="the Gretl User's Guide"> for details. The sub-commands have the following effects: <@lit="add"> adds the last model estimated to the model table, if possible; <@lit="show"> displays the model table in a window; and <@lit="free"> clears the table. 

To call for printing of the model table, use the flag <@opt="--⁠output="> plus a filename. If the filename has the suffix "<@lit=".tex">", the output will be in TeX format; if the suffix is "<@lit=".rtf">" the output will be RTF; otherwise it will be plain text. In the case of TeX output the default is to produce a "fragment", suitable for inclusion in a document; if you want a stand-alone document instead, use the <@opt="--⁠complete"> option, for example 

<code>          
   modeltab --output="myfile.tex" --complete
</code>

Menu path: Session icon window, Model table icon

# modprint Printing

Arguments: 	<@var="coeffmat"> <@var="names"> [ <@var="addstats"> ] 

Prints the coefficient table and optional additional statistics for a model estimated "by hand". Mainly useful for user-written functions. 

The argument <@var="coeffmat"> should be a <@mth="k"> by 2 matrix containing <@mth="k"> coefficients and <@mth="k"> associated standard errors, and <@var="names"> should be a string containing at least <@mth="k"> names for the coefficients, separated by commas or spaces. (The <@var="names"> argument may be either the name of a string variable or a literal string, enclosed in double quotes.) 

The optional argument <@var="addstats"> is a vector containing <@mth="p"> additional statistics to be printed under the coefficient table. If this argument is given, then <@var="names"> should contain <@mth="k + p"> comma-separated strings, the additional <@mth="p"> strings to be associated with the additional statistics. 

# modtest Tests

Argument: 	[ <@var="order"> ] 
Options: 	<@lit="--normality"> (normality of residual)
		<@lit="--logs"> (non-linearity, logs)
		<@lit="--autocorr"> (serial correlation)
		<@lit="--arch"> (ARCH)
		<@lit="--squares"> (non-linearity, squares)
		<@lit="--white"> (heteroskedasticity, White's test)
		<@lit="--white-nocross"> (White's test, squares only)
		<@lit="--breusch-pagan"> (heteroskedasticity, Breusch–Pagan)
		<@lit="--robust"> (robust variance estimate for Breusch–Pagan)
		<@lit="--panel"> (heteroskedasticity, groupwise)
		<@lit="--comfac"> (common factor restriction, AR1 models only)
		<@lit="--quiet"> (don't print details)
		<@lit="--silent"> (don't print anything)

Must immediately follow an estimation command. Depending on the option given, this command carries out one of the following: the Doornik–Hansen test for the normality of the error term; a Lagrange Multiplier test for nonlinearity (logs or squares); White's test (with or without cross-products) or the Breusch–Pagan test (<@bib="Breusch and Pagan, 1979;breusch-pagan79">) for heteroskedasticity; the LMF test for serial correlation <@bib="(Kiviet, 1986);kiviet86">; a test for ARCH (Autoregressive Conditional Heteroskedasticity; see also the <@lit="arch"> command); or a test of the common factor restriction implied by AR(1) estimation. With the exception of the normality and common factor test most of the options are only available for models estimated via OLS, but see below for details regarding two-stage least squares. 

The optional <@lit="order"> argument is relevant only in case the <@opt="--⁠autocorr"> or <@opt="--⁠arch"> options are selected. The default is to run these tests using a lag order equal to the periodicity of the data, but this can be adjusted by supplying a specific lag order. 

The <@opt="--⁠robust"> option applies only when the Breusch–Pagan test is selected; its effect is to use the robust variance estimator proposed by <@bib="Koenker (1981);koenker81">, making the test less sensitive to the assumption of normality. 

The <@opt="--⁠panel"> option is available only when the model is estimated on panel data: in this case a test for groupwise heteroskedasticity is performed (that is, for a differing error variance across the cross-sectional units). 

The <@opt="--⁠comfac"> option is available only when the model is estimated via an AR(1) method such as Hildreth–Lu. The auxiliary regression takes the form of a relatively unrestricted dynamic model, which is used to test the common factor restriction implicit in the AR(1) specification. 

By default, the program prints the auxiliary regression on which the test statistic is based, where applicable. This may be suppressed by using the <@opt="--⁠quiet"> flag (minimal printed output) or the <@opt="--⁠silent"> flag (no printed output). The test statistic and its p-value may be retrieved using the accessors <@lit="$test"> and <@lit="$pvalue"> respectively. 

When a model has been estimated by two-stage least squares (see <@ref="tsls">), the LM principle breaks down and gretl offers some equivalents: the <@lit="--autocorr"> option computes Godfrey's test for autocorrelation <@bib="(Godfrey, 1994);godfrey94"> while the <@lit="--white"> option yields the HET1 heteroskedasticity test <@bib="(Pesaran and Taylor, 1999);pesaran99">. 

Menu path: Model window, /Tests

# mpols Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--vcv"> (print covariance matrix)
		<@lit="--simple-print"> (do not print auxiliary statistics)
		<@lit="--quiet"> (suppress printing of results)

Computes OLS estimates for the specified model using multiple precision floating-point arithmetic, with the help of the Gnu Multiple Precision (GMP) library. By default 256 bits of precision are used for the calculations, but this can be increased via the environment variable <@lit="GRETL_MP_BITS">. For example, when using the bash shell one could issue the following command, before starting gretl, to set a precision of 1024 bits. 

<code>          
   export GRETL_MP_BITS=1024
</code>

A rather arcane option is available for this command (primarily for testing purposes): if the <@var="indepvars"> list is followed by a semicolon and a further list of numbers, those numbers are taken as powers of <@var="x"> to be added to the regression, where <@var="x"> is the last variable in <@var="indepvars">. These additional terms are computed and stored in multiple precision. In the following example <@lit="y"> is regressed on <@lit="x"> and the second, third and fourth powers of <@lit="x">: 

<code>          
   mpols y 0 x ; 2 3 4
</code>

Menu path: /Model/Other linear models/High precision OLS

# negbin Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> [ ; <@var="offset"> ] 
Options: 	<@lit="--model1"> (use NegBin 1 model)
		<@lit="--robust"> (QML covariance matrix)
		<@lit="--cluster">=<@var="clustvar"> (see <@ref="logit"> for explanation)
		<@lit="--opg"> (see below)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--verbose"> (print details of iterations)

Estimates a Negative Binomial model. The dependent variable is taken to represent a count of the occurrence of events of some sort, and must have only non-negative integer values. By default the model NegBin 2 is used, in which the conditional variance of the count is given by μ(1 + αμ), where μ denotes the conditional mean. But if the <@opt="--⁠model1"> option is given the conditional variance is μ(1 + α). 

The optional <@lit="offset"> series works in the same way as for the <@ref="poisson"> command. The Poisson model is a restricted form of the Negative Binomial in which α = 0 by construction. 

By default, standard errors are computed using a numerical approximation to the Hessian at convergence. But if the <@opt="--⁠opg"> option is given the covariance matrix is based on the Outer Product of the Gradient (OPG), or if the <@opt="--⁠robust"> option is given QML standard errors are calculated, using a "sandwich" of the inverse of the Hessian and the OPG. 

Menu path: /Model/Limited dependent variable/Count data...

# nls Estimation

Arguments: 	<@var="function"> [ <@var="derivatives"> ] 
Options: 	<@lit="--quiet"> (don't show estimated model)
		<@lit="--robust"> (robust standard errors)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--verbose"> (print details of iterations)
Examples: 	<@inp="wg_nls.inp">

Performs Nonlinear Least Squares (NLS) estimation using a modified version of the Levenberg–Marquardt algorithm. You must supply a function specification. The parameters of this function must be declared and given starting values (using the <@lit="genr"> command) prior to estimation. Optionally, you may specify the derivatives of the regression function with respect to each of the parameters. If you do not supply derivatives you should instead give a list of the parameters to be estimated (separated by spaces or commas), preceded by the keyword <@lit="params">. In the latter case a numerical approximation to the Jacobian is computed. 

It is easiest to show what is required by example. The following is a complete script to estimate the nonlinear consumption function set out in William Greene's <@itl="Econometric Analysis"> (Chapter 11 of the 4th edition, or Chapter 9 of the 5th). The numbers to the left of the lines are for reference and are not part of the commands. Note that any option flags, such as <@opt="--⁠vcv"> for printing the covariance matrix of the parameter estimates, should be appended to the final command, <@lit="end nls">. 

<code>          
   1   open greene11_3.gdt
   2   ols C 0 Y
   3   scalar a = $coeff(0)
   4   scalar b = $coeff(Y)
   5   scalar g = 1.0
   6   nls C = a + b * Y^g
   7    deriv a = 1
   8    deriv b = Y^g
   9    deriv g = b * Y^g * log(Y)
   10  end nls --vcv
</code>

It is often convenient to initialize the parameters by reference to a related linear model; that is accomplished here on lines 2 to 5. The parameters alpha, beta and gamma could be set to any initial values (not necessarily based on a model estimated with OLS), although convergence of the NLS procedure is not guaranteed for an arbitrary starting point. 

The actual NLS commands occupy lines 6 to 10. On line 6 the <@lit="nls"> command is given: a dependent variable is specified, followed by an equals sign, followed by a function specification. The syntax for the expression on the right is the same as that for the <@lit="genr"> command. The next three lines specify the derivatives of the regression function with respect to each of the parameters in turn. Each line begins with the keyword <@lit="deriv">, gives the name of a parameter, an equals sign, and an expression whereby the derivative can be calculated (again, the syntax here is the same as for <@lit="genr">). As an alternative to supplying numerical derivatives, you could substitute the following for lines 7 to 9: 

<code>          
   params a b g
</code>

Line 10, <@lit="end nls">, completes the command and calls for estimation. Any options should be appended to this line. 

For further details on NLS estimation please see <@pdf="the Gretl User's Guide">. 

Menu path: /Model/Nonlinear Least Squares

# normtest Tests

Argument: 	<@var="series"> 
Options: 	<@lit="--dhansen"> (Doornik–Hansen test, the default)
		<@lit="--swilk"> (Shapiro–Wilk test)
		<@lit="--lillie"> (Lilliefors test)
		<@lit="--jbera"> (Jarque–Bera test)
		<@lit="--all"> (do all tests)
		<@lit="--quiet"> (suppress printed output)

Carries out a test for normality for the given <@var="series">. The specific test is controlled by the option flags (but if no flag is given, the Doornik–Hansen test is performed). Note: the Doornik–Hansen and Shapiro–Wilk tests are recommended over the others, on account of their superior small-sample properties. 

The test statistic and its p-value may be retrieved using the accessors <@lit="$test"> and <@lit="$pvalue">. Please note that if the <@opt="--⁠all"> option is given, the result recorded is that from the Doornik–Hansen test. 

Menu path: /Variable/Normality test

# nulldata Dataset

Argument: 	<@var="series_length"> 
Option: 	<@lit="--preserve"> (preserve matrices)
Example: 	<@lit="nulldata 500">

Establishes a "blank" data set, containing only a constant and an index variable, with periodicity 1 and the specified number of observations. This may be used for simulation purposes: some of the <@lit="genr"> commands (e.g. <@lit="genr uniform()">, <@lit="genr normal()">) will generate dummy data from scratch to fill out the data set. This command may be useful in conjunction with <@lit="loop">. See also the "seed" option to the <@ref="set"> command. 

By default, this command cleans out all data in gretl's current workspace. If you give the <@opt="--⁠preserve"> option, however, any currently defined matrices are retained. 

Menu path: /File/New data set

# ols Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--vcv"> (print covariance matrix)
		<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (clustered standard errors)
		<@lit="--jackknife"> (see below)
		<@lit="--simple-print"> (do not print auxiliary statistics)
		<@lit="--quiet"> (suppress printing of results)
		<@lit="--anova"> (print an ANOVA table)
		<@lit="--no-df-corr"> (suppress degrees of freedom correction)
		<@lit="--print-final"> (see below)
Examples: 	<@lit="ols 1 0 2 4 6 7">
		<@lit="ols y 0 x1 x2 x3 --vcv">
		<@lit="ols y 0 x1 x2 x3 --quiet">

Computes ordinary least squares (OLS) estimates with <@var="depvar"> as the dependent variable and <@var="indepvars"> as the list of independent variables. Variables may be specified by name or number; use the number zero for a constant term. 

Besides coefficient estimates and standard errors, the program also prints p-values for <@mth="t"> (two-tailed) and <@mth="F">-statistics. A p-value below 0.01 indicates statistical significance at the 1 percent level and is marked with <@lit="***">. <@lit="**"> indicates significance between 1 and 5 percent and <@lit="*"> indicates significance between the 5 and 10 percent levels. Model selection statistics (the Akaike Information Criterion or AIC and Schwarz's Bayesian Information Criterion) are also printed. The formula used for the AIC is that given by <@bib="Akaike (1974);akaike74">, namely minus two times the maximized log-likelihood plus two times the number of parameters estimated. 

If the option <@opt="--⁠no-df-corr"> is given, the usual degrees of freedom correction is not applied when calculating the estimated error variance (and hence also the standard errors of the parameter estimates). 

The option <@opt="--⁠print-final"> is applicable only in the context of a <@ref="loop">. It arranges for the regression to be run silently on all but the final iteration of the loop. See <@pdf="the Gretl User's Guide"> for details. 

Various internal variables may be retrieved following estimation. For example 

<code>          
   series uh = $uhat
</code>

saves the residuals under the name <@lit="uh">. See the "accessors" section of the gretl function reference for details. 

The specific formula ("HC" version) used for generating robust standard errors when the <@opt="--⁠robust"> option is given can be adjusted via the <@ref="set"> command. The <@opt="--⁠jackknife"> option has the effect of selecting an <@lit="hc_version"> of <@lit="3a">. The <@opt="--⁠cluster"> overrides the selection of HC version, and produces robust standard errors by grouping the observations by the distinct values of <@var="clustvar">; see <@pdf="the Gretl User's Guide"> for details. 

Menu path: /Model/Ordinary Least Squares
Other access: Beta-hat button on toolbar

# omit Tests

Argument: 	<@var="varlist"> 
Options: 	<@lit="--test-only"> (don't replace the current model)
		<@lit="--chi-square"> (give chi-square form of Wald test)
		<@lit="--quiet"> (print only the basic test result)
		<@lit="--silent"> (don't print anything)
		<@lit="--vcv"> (print covariance matrix for reduced model)
		<@lit="--auto">[=<@var="alpha">] (sequential elimination, see below)
Examples: 	<@lit="omit 5 7 9">
		<@lit="omit seasonals --quiet">
		<@lit="omit --auto">
		<@lit="omit --auto=0.05">

This command must follow an estimation command. It calculates a Wald test for the joint significance of the variables in <@var="varlist">, which should be a subset of the independent variables in the model last estimated. The results of the test may be retrieved using the accessors <@lit="$test"> and <@lit="$pvalue">. 

By default the restricted model is estimated and it replaces the original as the "current model" for the purposes of, for example, retrieving the residuals as <@lit="$uhat"> or doing further tests. This behavior may be suppressed via the <@opt="--⁠test-only"> option. 

By default the <@mth="F">-form of the Wald test is recorded; the <@opt="--⁠chi-square"> option may be used to record the chi-square form instead. 

If the restricted model is both estimated and printed, the <@opt="--⁠vcv"> option has the effect of printing its covariance matrix, otherwise this option is ignored. 

Alternatively, if the <@opt="--⁠auto"> flag is given, sequential elimination is performed: at each step the variable with the highest p-value is omitted, until all remaining variables have a p-value no greater than some cutoff. The default cutoff is 10 percent (two-sided); this can be adjusted by appending "<@lit="=">" and a value between 0 and 1 (with no spaces), as in the fourth example above. If <@var="varlist"> is given this process is confined to the listed variables, otherwise all variables are treated as candidates for omission. Note that the <@opt="--⁠auto"> and <@opt="--⁠test-only"> options cannot be combined. 

Menu path: Model window, /Tests/Omit variables

# open Dataset

Argument: 	<@var="filename"> 
Options: 	<@lit="--quiet"> (don't print list of series)
		<@lit="--preserve"> (preserve variables other than series)
		<@lit="--frompkg">=<@var="pkgname"> (see below)
		<@lit="--www"> (use a database on the gretl server)
		See below for additional specialized options
Examples: 	<@lit="open data4-1">
		<@lit="open voter.dta">
		<@lit="open fedbog --www">

Opens a data file or database. If a data file is already open, it is replaced by the newly opened one. To add data to the current dataset, see <@ref="append"> and (for greater flexibility) <@ref="join">. 

If a full path is not given, the program will search some relevant paths to try to find the file. If no filename suffix is given (as in the first example above), gretl assumes a native datafile with suffix <@lit=".gdt">. Based on the name of the file and various heuristics, gretl will try to detect the format of the data file (native, plain text, CSV, MS Excel, Stata, SPSS, etc.). 

If the <@opt="--⁠frompkg"> option is used, gretl will look for the specified data file in the subdirectory associated with the function package specified by <@var="pkgname">. 

If the <@var="filename"> argument takes the form of a URI starting with <@lit="http://">, then gretl will attempt to download the indicated data file before opening it. 

By default, opening a new data file clears the current gretl session, which includes deletion of all named variables, including matrices, scalars and strings. If you wish to keep your currently defined variables (other than series, which are necessarily cleared out), use the <@opt="--⁠preserve"> option. 

The <@lit="open"> command can also be used to open a database (gretl, RATS 4.0 or PcGive) for reading. In that case it should be followed by the <@ref="data"> command to extract particular series from the database. If the <@lit="www"> option is given, the program will try to access a database of the given name on the gretl server — for instance the Federal Reserve interest rates database in the third example above. 

When opening a spreadsheet file (Gnumeric, Open Document or MS Excel), you may give up to three additional parameters following the filename. First, you can select a particular worksheet within the file. This is done either by giving its (1-based) number, using the syntax, e.g., <@opt="--⁠sheet=2">, or, if you know the name of the sheet, by giving the name in double quotes, as in <@opt="--⁠sheet="MacroData"">. The default is to read the first worksheet. You can also specify a column and/or row offset into the worksheet via, e.g., 

<code>          
   --coloffset=3 --rowoffset=2
</code>

which would cause gretl to ignore the first 3 columns and the first 2 rows. The default is an offset of 0 in both dimensions, that is, to start reading at the top-left cell. 

With plain text files, gretl generally expects to find the data columns delimited in some standard manner. But there is also a special facility for reading "fixed format" files, in which there are no delimiters but there is a known specification of the form, e.g., "variable <@mth="k"> occupies 8 columns starting at column 24". To read such files, you should append a string <@opt="--⁠fixed-cols="><@var="colspec">, where <@var="colspec"> is composed of comma-separated integers. These integers are interpreted as a set of pairs. The first element of each pair denotes a starting column, measured in bytes from the beginning of the line with 1 indicating the first byte; and the second element indicates how many bytes should be read for the given field. So, for example, if you say 

<code>          
   open fixed.txt --fixed-cols=1,6,20,3
</code>

then for variable 1 gretl will read 6 bytes starting at column 1; and for variable 2, 3 bytes starting at column 20. Lines that are blank, or that begin with <@lit="#">, are ignored, but otherwise the column-reading template is applied, and if anything other than a valid numerical value is found an error is flagged. If the data are read successfully, the variables will be named <@lit="v1">, <@lit="v2">, etc. It's up to the user to provide meaningful names and/or descriptions using the commands <@ref="rename"> and/or <@ref="setinfo">. 

Menu path: /File/Open data
Other access: Drag a data file onto gretl's main window

# orthdev Transformations

Argument: 	<@var="varlist"> 

Applicable with panel data only. A series of forward orthogonal deviations is obtained for each variable in <@var="varlist"> and stored in a new variable with the prefix <@lit="o_">. Thus <@lit="orthdev x y"> creates the new variables <@lit="o_x"> and <@lit="o_y">. 

The values are stored one step ahead of their true temporal location (that is, <@lit="o_x"> at observation <@mth="t"> holds the deviation that, strictly speaking, belongs at <@mth="t"> – 1). This is for compatibility with first differences: one loses the first observation in each time series, not the last. 

# outfile Printing

Variants: 	<@lit="outfile"> <@var="filename"> <@var="option">
		<@lit="outfile --close">
Options: 	<@lit="--append"> (append to file)
		<@lit="--write"> (overwrite file)
		<@lit="--quiet"> (see below)
Examples: 	<@lit="outfile regress.txt --write">
		<@lit="outfile --close">

Diverts output to <@var="filename">, until further notice. Use the flag <@opt="--⁠append"> to append output to an existing file or <@opt="--⁠write"> to start a new file (or overwrite an existing one). Only one file can be opened in this way at any given time. 

The <@opt="--⁠close"> flag is used to close an output file that was previously opened as above. Output will then revert to the default stream. Note that since only one file can be opened via <@lit="outfile"> at any given time, no filename argument need (nor should) be supplied with this variant of the command. 

In the first example command above, the file <@lit="regress.txt"> is opened for writing, and in the second it is closed. This would make sense as a sequence only if some commands were issued before the <@opt="--⁠close">. For example if an <@lit="ols"> command intervened, its output would go to <@lit="regress.txt"> rather than the screen. 

Three special variants on the above are available. If you give the keyword <@lit="null"> in place of a real filename along with the <@opt="--⁠write"> option, the effect is to suppress all printed output until redirection is ended. If either of the keywords <@lit="stdout"> or <@lit="stderr"> are given in place of a regular filename the effect is to redirect output to standard output or standard error output respectively. 

The <@opt="--⁠quiet"> option is for use with <@opt="--⁠write"> or <@opt="--⁠append">: its effect is to turn off the echoing of commands and the printing of auxiliary messages while output is redirected. It is equivalent to doing 

<code>          
   set echo off
   set messages off
</code>

except that when redirection is ended the original values of the <@lit="echo"> and <@lit="messages"> variables are restored. 

# panel Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--vcv"> (print covariance matrix)
		<@lit="--fixed-effects"> (estimate with group fixed effects)
		<@lit="--random-effects"> (random effects or GLS model)
		<@lit="--nerlove"> (use the Nerlove transformation)
		<@lit="--between"> (estimate the between-groups model)
		<@lit="--robust"> (robust standard errors; see below)
		<@lit="--time-dummies"> (include time dummy variables)
		<@lit="--unit-weights"> (weighted least squares)
		<@lit="--iterate"> (iterative estimation)
		<@lit="--matrix-diff"> (use matrix-difference method for Hausman test)
		<@lit="--quiet"> (less verbose output)
		<@lit="--verbose"> (more verbose output)

Estimates a panel model. By default the fixed effects estimator is used; this is implemented by subtracting the group or unit means from the original data. 

If the <@opt="--⁠random-effects"> flag is given, random effects estimates are computed, by default using the method of <@bib="Swamy and Arora (1972);swamy72">. In this case (only) the option <@opt="--⁠matrix-diff"> forces use of the matrix-difference method (as opposed to the regression method) for carrying out the Hausman test for the consistency of the random effects estimator. Also specific to the random effects estimator is the <@opt="--⁠nerlove"> flag, which selects the method of <@bib="Nerlove (1971);nerlove71"> as opposed to Swamy and Arora. 

Alternatively, if the <@opt="--⁠unit-weights"> flag is given, the model is estimated via weighted least squares, with the weights based on the residual variance for the respective cross-sectional units in the sample. In this case (only) the <@opt="--⁠iterate"> flag may be added to produce iterative estimates: if the iteration converges, the resulting estimates are Maximum Likelihood. 

As a further alternative, if the <@opt="--⁠between"> flag is given, the between-groups model is estimated (that is, an OLS regression using the group means). 

The <@opt="--⁠robust"> option is available only for fixed effects models. The default variant is the Arellano HAC estimator, but Beck–Katz "Panel Corrected Standard Errors" can be selected via the command <@lit="set pcse on">. When the robust option is specified the joint <@mth="F"> test on the fixed effects is performed using the robust method of <@bib="Welch (1951);welch51">. 

For more details on panel estimation, please see <@pdf="the Gretl User's Guide">. 

Menu path: /Model/Panel

# pca Statistics

Argument: 	<@var="varlist"> 
Options: 	<@lit="--covariance"> (use the covariance matrix)
		<@lit="--save">[=<@var="n">] (save major components)
		<@lit="--save-all"> (save all components)
		<@lit="--quiet"> (don't print results)

Principal Components Analysis. Unless the <@opt="--⁠quiet"> option is given, prints the eigenvalues of the correlation matrix (or the covariance matrix if the <@opt="--⁠covariance"> option is given) for the variables in <@var="varlist">, along with the proportion of the joint variance accounted for by each component. Also prints the corresponding eigenvectors (or "component loadings"). 

If you give the <@opt="--⁠save-all"> option then all components are saved to the dataset as series, with names <@lit="PC1">, <@lit="PC2"> and so on. These artificial variables are formed as the sum of (component loading) times (standardized <@mth="X"><@sub="i">), where <@mth="X"><@sub="i"> denotes the <@mth="i">th variable in <@var="varlist">. 

If you give the <@opt="--⁠save"> option without a parameter value, components with eigenvalues greater than the mean (which means greater than 1.0 if the analysis is based on the correlation matrix) are saved to the dataset as described above. If you provide a value for <@var="n"> with this option then the most important <@var="n"> components are saved. 

See also the <@xrf="princomp"> function. 

Menu path: /View/Principal components
Other access: Main window pop-up (multiple selection)

# pergm Statistics

Arguments: 	<@var="series"> [ <@var="bandwidth"> ] 
Options: 	<@lit="--bartlett"> (use Bartlett lag window)
		<@lit="--log"> (use log scale)
		<@lit="--radians"> (show frequency in radians)
		<@lit="--degrees"> (show frequency in degrees)
		<@lit="--plot">=<@var="mode-or-filename"> (see below)

Computes and displays the spectrum of the specified series. By default the sample periodogram is given, but optionally a Bartlett lag window is used in estimating the spectrum (see, for example, Greene's <@itl="Econometric Analysis"> for a discussion of this). The default width of the Bartlett window is twice the square root of the sample size but this can be set manually using the <@var="bandwidth"> parameter, up to a maximum of half the sample size. 

If the <@opt="--⁠log"> option is given the spectrum is represented on a logarithmic scale. 

The (mutually exclusive) options <@opt="--⁠radians"> and <@opt="--⁠degrees"> influence the appearance of the frequency axis when the periodogram is graphed. By default the frequency is scaled by the number of periods in the sample, but these options cause the axis to be labeled from 0 to π radians or from 0 to 180°, respectively. 

By default, if the program is not in batch mode a plot of the periodogram is shown. This can be adjusted via the <@opt="--⁠plot"> option. The acceptable parameters to this option are <@lit="none"> (to suppress the plot); <@lit="display"> (to display a plot even when in batch mode); or a file name. The effect of providing a file name is as described for the <@opt="--⁠output"> option of the <@ref="gnuplot"> command. 

Menu path: /Variable/Periodogram
Other access: Main window pop-up menu (single selection)

# plot Graphs

Argument: 	<@var="data"> 
Options: 	<@lit="--with-lines">[=<@var="varspec">] (use lines, not points)
		<@lit="--with-lp">[=<@var="varspec">] (use lines and points)
		<@lit="--with-impulses">[=<@var="varspec">] (use vertical lines)
		<@lit="--time-series"> (plot against time)
		<@lit="--single-yaxis"> (force use of just one y-axis)
		<@lit="--dummy"> (see below)
		<@lit="--fit">=<@var="fitspec"> (see below)
		<@lit="--output">=<@var="filename"> (send output to specified file)

The <@lit="plot"> block provides an alternative to the <@ref="gnuplot"> command which may be more convenient when you are producing an elaborate plot (with several options and/or gnuplot commands to be inserted into the plot file). 

A <@lit="plot"> block starts with the command-word <@lit="plot"> followed by the required argument, <@var="data">, which specifies the data to be plotted: this should be the name of a list, a matrix, or a single series. 

If a list or matrix is given, the last element (list) or column (matrix) is assumed to be the <@mth="x">-axis variable and the other(s) the <@mth="y">-axis variable(s), unless the <@opt="--⁠time-series"> option is given in which case all the specified data go on the <@mth="y"> axis. 

The option of supplying a single series name is restricted to time-series data, in which case it is assumed that a time-series plot is wanted; otherwise an error is flagged. 

The starting line may be prefixed with the "<@var="savename"> <@lit="<-">" apparatus to save a plot as an icon in the GUI program. The block ends with <@lit="end plot">. 

Inside the block you have zero or more lines of these types, identified by an initial keyword: 

<indent>
• <@lit="option">: specify a single option. 
</indent>

<indent>
• <@lit="options">: specify multiple options on a single line, separated by spaces. 
</indent>

<indent>
• <@lit="literal">: a command to be passed to gnuplot literally. 
</indent>

<indent>
• <@lit="printf">: a printf statement whose result will be passed to gnuplot literally. 
</indent>

Note that when you specify an option using the <@lit="option"> or <@lit="options"> keywords, it is not necessary to supply the customary double-dash before the option specifier. For details on the effects of the various options please see <@ref="gnuplot">. 

The intended use of the <@lit="plot"> block is best illustrated by example: 

<code>          
   string title = "My title"
   string xname = "My x-variable"
   plot plotmat
       options with-lines fit=none
       literal set linetype 3 lc rgb "#0000ff"
       literal set nokey
       printf "set title \"%s\"", title
       printf "set xlabel \"%s\"", xname
   end plot --output=display
</code>

This example assumes that <@lit="plotmat"> is the name of a matrix with at least 2 columns (or a list with at least two members). Note that it is considered good practice to place the <@opt="--⁠output"> option (only) on the last line of the block. 

# poisson Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> [ ; <@var="offset"> ] 
Options: 	<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (see <@ref="logit"> for explanation)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--verbose"> (print details of iterations)
Examples: 	<@lit="poisson y 0 x1 x2">
		<@lit="poisson y 0 x1 x2 ; S">

Estimates a poisson regression. The dependent variable is taken to represent the occurrence of events of some sort, and must take on only non-negative integer values. 

If a discrete random variable <@mth="Y"> follows the Poisson distribution, then 

  <@fig="poisson1">

for <@mth="y"> = 0, 1, 2,…. The mean and variance of the distribution are both equal to <@mth="v">. In the Poisson regression model, the parameter <@mth="v"> is represented as a function of one or more independent variables. The most common version (and the only one supported by gretl) has 

  <@fig="poisson2">

or in other words the log of <@mth="v"> is a linear function of the independent variables. 

Optionally, you may add an "offset" variable to the specification. This is a scale variable, the log of which is added to the linear regression function (implicitly, with a coefficient of 1.0). This makes sense if you expect the number of occurrences of the event in question to be proportional, other things equal, to some known factor. For example, the number of traffic accidents might be supposed to be proportional to traffic volume, other things equal, and in that case traffic volume could be specified as an "offset" in a Poisson model of the accident rate. The offset variable must be strictly positive. 

By default, standard errors are computed using the negative inverse of the Hessian. If the <@opt="--⁠robust"> flag is given, then QML or Huber–White standard errors are calculated instead. In this case the estimated covariance matrix is a "sandwich" of the inverse of the estimated Hessian and the outer product of the gradient. 

See also <@ref="negbin">. 

Menu path: /Model/Limited dependent variable/Count data...

# print Printing

Variants: 	<@lit="print"> <@var="varlist">
		<@lit="print">
		<@lit="print"> <@var="object_name">
		<@lit="print"> <@var="string_literal">
Options: 	<@lit="--byobs"> (by observations)
		<@lit="--no-dates"> (use simple observation numbers)
Examples: 	<@lit="print x1 x2 --byobs">
		<@lit="print my_matrix">
		<@lit="print "This is a string"">

If <@var="varlist"> is given, prints the values of the specified series, or if no argument is given, prints the values of all series in the current dataset. If the <@opt="--⁠byobs"> flag is added the data are printed by observation, otherwise they are printed by variable. When printing by observation, the default is to show the date (with time-series data) or the observation marker string (if any) at the start of each line. The <@opt="--⁠no-dates"> option suppresses the printing of dates or markers; a simple observation number is shown instead. 

Besides printing series, you may give the name of a (single) matrix or scalar variable for printing. Or you may give a literal string argument, enclosed in double quotes, to be printed as is. In these case the option flags are not applicable. 

Note that you can gain greater control over the printing format (and so, for example, expose a greater number of digits than are shown by default) by using <@ref="printf">. 

Menu path: /Data/Display values

# printf Printing

Arguments: 	<@var="format"> <@lit=", "><@var="args"> 

Prints scalar values, series, matrices, or strings under the control of a format string (providing a subset of the <@lit="printf()"> statement in the C programming language). Recognized numeric formats are <@lit="%e">, <@lit="%E">, <@lit="%f">, <@lit="%g">, <@lit="%G"> and <@lit="%d">, in each case with the various modifiers available in C. Examples: the format <@lit="%.10g"> prints a value to 10 significant figures; <@lit="%12.6f"> prints a value to 6 decimal places, with a width of 12 characters. The format <@lit="%s"> should be used for strings. 

The format string itself must be enclosed in double quotes. The values to be printed must follow the format string, separated by commas. These values should take the form of either (a) the names of variables, (b) expressions that are valid for the <@lit="genr"> command, or (c) the special functions <@lit="varname()"> or <@lit="date()">. The following example prints the values of two variables plus that of a calculated expression: 

<code>          
   ols 1 0 2 3
   scalar b = $coeff[2]
   scalar se_b = $stderr[2]
   printf "b = %.8g, standard error %.8g, t = %.4f\n", 
          b, se_b, b/se_b
</code>

The next lines illustrate the use of the varname and date functions, which respectively print the name of a variable, given its ID number, and a date string, given a 1-based observation number. 

<code>          
   printf "The name of variable %d is %s\n", i, varname(i)
   printf "The date of observation %d is %s\n", j, date(j)
</code>

If a matrix argument is given in association with a numeric format, the entire matrix is printed using the specified format for each element. The same applies to series, except that the range of values printed is governed by the current sample setting. 

The maximum length of a format string is 127 characters. The escape sequences <@lit="\n"> (newline), <@lit="\t"> (tab), <@lit="\v"> (vertical tab) and <@lit="\\"> (literal backslash) are recognized. To print a literal percent sign, use <@lit="%%">. 

As in C, numerical values that form part of the format (width and or precision) may be given directly as numbers, as in <@lit="%10.4f">, or they may be given as variables. In the latter case, one puts asterisks into the format string and supplies corresponding arguments in order. For example, 

<code>          
   scalar width = 12
   scalar precision = 6
   printf "x = %*.*f\n", width, precision, x
</code>

# probit Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (see <@ref="logit"> for explanation)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--verbose"> (print details of iterations)
		<@lit="--p-values"> (show p-values instead of slopes)
		<@lit="--random-effects"> (estimates a random effects panel probit model)
		<@lit="--quadpoints">=<@var="k"> (number of quadrature points for RE estimation)
Examples: 	<@inp="ooballot.inp">, <@inp="oprobit.inp">, <@inp="reprobit.inp">

If the dependent variable is a binary variable (all values are 0 or 1) maximum likelihood estimates of the coefficients on <@var="indepvars"> are obtained via the Newton–Raphson method. As the model is nonlinear the slopes depend on the values of the independent variables. By default the slopes with respect to each of the independent variables are calculated (at the means of those variables) and these slopes replace the usual p-values in the regression output. This behavior can be suppressed my giving the <@opt="--⁠p-values"> option. The chi-square statistic tests the null hypothesis that all coefficients are zero apart from the constant. 

By default, standard errors are computed using the negative inverse of the Hessian. If the <@opt="--⁠robust"> flag is given, then QML or Huber–White standard errors are calculated instead. In this case the estimated covariance matrix is a "sandwich" of the inverse of the estimated Hessian and the outer product of the gradient. See chapter 10 of Davidson and MacKinnon for details. 

If the dependent variable is not binary but is discrete, then Ordered Probit estimates are obtained. (If the variable selected as dependent is not discrete, an error is flagged.) 

<@itl="Probit for panel data"> 

With the <@opt="--⁠random-effects"> option, the error term is assumed to be composed of two normally distributed components: one time-invariant term that is specific to the cross-sectional unit or "individual" (and is known as the individual effect); and one term that is specific to the particular observation. 

Evaluation of the likelihood for this model involves the use of Gauss-Hermite quadrature for approximating the value of expectations of functions of normal variates. The number of quadrature points used can be chosen through the <@opt="--⁠quadpoints"> option (the default is 32). Using more points will increase the accuracy of the results, but at the cost of longer compute time; with many quadrature points and a large dataset estimation may be quite time consuming. 

Besides the usual parameter estimates (and associated statistics) relating to the included regressors, certain additional information is presented on estimation of this sort of model: 

<indent>
• <@lit="lnsigma2">: the maximum likelihood estimate of the log of the variance of the individual effect; 
</indent>

<indent>
• <@lit="sigma_u">: the estimated standard deviation of the individual effect; and 
</indent>

<indent>
• <@lit="rho">: the estimated share of the individual effect in the composite error variance (also known as the intra-class correlation). 
</indent>

The Likelihood Ratio test of the null hypothesis that <@lit="rho"> equals zero provides a means of assessing whether the random effects specification is needed. If the null is not rejected that suggests that a simple pooled probit specification is adequate. 

Menu path: /Model/Limited dependent variable/Probit

# pvalue Utilities

Arguments: 	<@var="dist"> [ <@var="params"> ] <@var="xval"> 
Examples: 	<@lit="pvalue z zscore">
		<@lit="pvalue t 25 3.0">
		<@lit="pvalue X 3 5.6">
		<@lit="pvalue F 4 58 fval">
		<@lit="pvalue G shape scale x">
		<@lit="pvalue B bprob 10 6">
		<@lit="pvalue P lambda x">
		<@lit="pvalue W shape scale x">

Computes the area to the right of <@var="xval"> in the specified distribution (<@lit="z"> for Gaussian, <@lit="t"> for Student's <@mth="t">, <@lit="X"> for chi-square, <@lit="F"> for <@mth="F">, <@lit="G"> for gamma, <@lit="B"> for binomial, <@lit="P"> for Poisson, or <@lit="W"> for Weibull). 

Depending on the distribution, the following information must be given, before the <@var="xval">: for the <@mth="t"> and chi-square distributions, the degrees of freedom; for <@mth="F">, the numerator and denominator degrees of freedom; for gamma, the shape and scale parameters; for the binomial distribution, the "success" probability and the number of trials; for the Poisson distribution, the parameter λ (which is both the mean and the variance); and for the Weibull distribution, shape and scale parameters. As shown in the examples above, the numerical parameters may be given in numeric form or as the names of variables. 

The parameters for the gamma distribution are sometimes given as mean and variance rather than shape and scale. The mean is the product of the shape and the scale; the variance is the product of the shape and the square of the scale. So the scale may be found as the variance divided by the mean, and the shape as the mean divided by the scale. 

Menu path: /Tools/P-value finder

# qlrtest Tests

Options: 	<@lit="--limit-to">=<@var="list"> (limit test to subset of regressors)
		<@lit="--plot">=<@var="mode-or-filename"> (see below)

For a model estimated on time-series data via OLS, performs the Quandt likelihood ratio (QLR) test for a structural break at an unknown point in time, with 15 percent trimming at the beginning and end of the sample period. 

For each potential break point within the central 70 percent of the observations, a Chow test is performed. See <@ref="chow"> for details; as with the regular Chow test, this is a robust Wald test if the original model was estimated with the <@opt="--⁠robust"> option, an F-test otherwise. The QLR statistic is then the maximum of the individual test statistics. 

An asymptotic p-value is obtained using the method of <@bib="Bruce Hansen (1997);hansen97">. 

Besides the standard hypothesis test accessors <@xrf="$test"> and <@xrf="$pvalue">, <@xrf="$qlrbreak"> can be used to retrieve the index of the observation at which the test statistic is maximized. 

The <@opt="--⁠limit-to"> option can be used to limit the set of interactions with the split dummy variable in the Chow tests to a subset of the original regressors. The parameter for this option must be a named list, all of whose members are among the original regressors. The list should not include the constant. 

When this command is run interactively (only), a plot of the Chow test statistic is displayed by default. This can be adjusted via the <@opt="--⁠plot"> option. The acceptable parameters to this option are <@lit="none"> (to suppress the plot); <@lit="display"> (to display a plot even when not in interactive mode); or a file name. The effect of providing a file name is as described for the <@opt="--⁠output"> option of the <@ref="gnuplot"> command. 

Menu path: Model window, /Tests/QLR test

# qqplot Graphs

Variants: 	<@lit="qqplot"> <@var="y">
		<@lit="qqplot"> <@var="y"> <@var="x">
Options: 	<@lit="--z-scores"> (see below)
		<@lit="--raw"> (see below)
		<@lit="--output">=<@var="filename"> (send output to specified file)

Given just one series argument, displays a plot of the empirical quantiles of the selected series (given by name or ID number) against the quantiles of the normal distribution. The series must include at least 20 valid observations in the current sample range. By default the empirical quantiles are plotted against quantiles of the normal distribution having the same mean and variance as the sample data, but two alternatives are available: if the <@opt="--⁠z-scores"> option is given the data are standardized, while if the <@opt="--⁠raw"> option is given the "raw" empirical quantiles are plotted against the quantiles of the standard normal distribution. 

The option <@opt="--⁠output"> has the effect to send the output to the desiderd filename; use "display" to force output to the screen, for example during a loop. 

Given two series arguments, <@var="y"> and <@var="x">, displays a plot of the empirical quantiles of <@var="y"> against those of <@var="x">. The data values are not standardized. 

Menu path: /Variable/Normal Q-Q plot
Menu path: /View/Graph specified vars/Q-Q plot

# quantreg Estimation

Arguments: 	<@var="tau"> <@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--robust"> (robust standard errors)
		<@lit="--intervals">[=<@var="level">] (compute confidence intervals)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--quiet"> (suppress printing of results)
Examples: 	<@lit="quantreg 0.25 y 0 xlist">
		<@lit="quantreg 0.5 y 0 xlist --intervals">
		<@lit="quantreg 0.5 y 0 xlist --intervals=.95">
		<@lit="quantreg tauvec y 0 xlist --robust">
		See also <@inp="mrw_qr.inp">

Quantile regression. The first argument, <@var="tau">, is the conditional quantile for which estimates are wanted. It may be given either as a numerical value or as the name of a pre-defined scalar variable; the value must be in the range 0.01 to 0.99. (Alternatively, a vector of values may be given for <@var="tau">; see below for details.) The second and subsequent arguments compose a regression list on the same pattern as <@ref="ols">. 

Without the <@opt="--⁠intervals"> option, standard errors are printed for the quantile estimates. By default, these are computed according to the asymptotic formula given by <@bib="Koenker and Bassett (1978);koenker-bassett78">, but if the <@opt="--⁠robust"> option is given, standard errors that are robust with respect to heteroskedasticity are calculated using the method of <@bib="Koenker and Zhao (1994);koenker-zhao94">. 

When the <@opt="--⁠intervals"> option is chosen, confidence intervals are given for the parameter estimates instead of standard errors. These intervals are computed using the rank inversion method, and in general they are asymmetrical about the point estimates. The specifics of the calculation are inflected by the <@opt="--⁠robust"> option: without this, the intervals are computed on the assumption of IID errors <@bib="(Koenker, 1994);koenker94">; with it, they use the robust estimator developed by <@bib="Koenker and Machado (1999);koenker-machado99">. 

By default, 90 percent confidence intervals are produced. You can change this by appending a confidence level (expressed as a decimal fraction) to the intervals option, as in <@opt="--⁠intervals=0.95">. 

Vector-valued <@var="tau">: instead of supplying a scalar, you may give the name of a pre-defined matrix. In this case estimates are computed for all the given <@var="tau"> values and the results are printed in a special format, showing the sequence of quantile estimates for each regressor in turn. 

Menu path: /Model/Robust estimation/Quantile regression

# quit Utilities

Exits from the program, giving you the option of saving the output from the session on the way out. 

Menu path: /File/Exit

# rename Dataset

Arguments: 	<@var="series"> <@var="newname"> 

Changes the name of <@var="series"> (identified by name or ID number) to <@var="newname">. The new name must be of 31 characters maximum, must start with a letter, and must be composed of only letters, digits, and the underscore character. 

Menu path: /Variable/Edit attributes
Other access: Main window pop-up menu (single selection)

# reset Tests

Options: 	<@lit="--quiet"> (don't print the auxiliary regression)
		<@lit="--squares-only"> (compute the test using only the squares)
		<@lit="--cubes-only"> (compute the test using only the cubes)

Must follow the estimation of a model via OLS. Carries out Ramsey's RESET test for model specification (non-linearity) by adding the square and/or the cube of the fitted values to the regression and calculating the <@mth="F"> statistic for the null hypothesis that the parameters on the added terms are zero. 

Both the square and the cube are added, unless one of the options <@opt="--⁠squares-only"> or <@opt="--⁠cubes-only"> is given. 

Menu path: Model window, /Tests/Ramsey's RESET

# restrict Tests

Options: 	<@lit="--quiet"> (don't print restricted estimates)
		<@lit="--silent"> (don't print anything)
		<@lit="--wald"> (system estimators only – see below)
		<@lit="--bootstrap"> (bootstrap the test if possible)
		<@lit="--full"> (OLS and VECMs only, see below)

Imposes a set of (usually linear) restrictions on either (a) the model last estimated or (b) a system of equations previously defined and named. In all cases the set of restrictions should be started with the keyword "restrict" and terminated with "end restrict". 

In the single equation case the restrictions are always implicitly to be applied to the last model, and they are evaluated as soon as the <@lit="restrict"> block is closed. 

In the case of a system of equations (defined via the <@ref="system"> command), the initial "restrict" may be followed by the name of a previously defined system of equations. If this is omitted and the last model was a system then the restrictions are applied to the last model. By default the restrictions are evaluated when the system is next estimated, using the <@ref="estimate"> command. But if the <@opt="--⁠wald"> option is given the restriction is tested right away, via a Wald chi-square test on the covariance matrix. Note that this option will produce an error if a system has been defined but not yet estimated. 

Depending on the context, the restrictions to be tested may be expressed in various ways. The simplest form is as follows: each restriction is given as an equation, with a linear combination of parameters on the left and a scalar value to the right of the equals sign (either a numerical constant or the name of a scalar variable). 

In the single-equation case, parameters may be referenced in the form <@lit="b["><@var="i"><@lit="]">, where <@var="i"> represents the position in the list of regressors (starting at 1), or <@lit="b["><@var="varname"><@lit="]">, where <@var="varname"> is the name of the regressor in question. In the system case, parameters are referenced using <@lit="b"> plus two numbers in square brackets. The leading number represents the position of the equation within the system and the second number indicates position in the list of regressors. For example <@lit="b[2,1]"> denotes the first parameter in the second equation, and <@lit="b[3,2]"> the second parameter in the third equation. The <@lit="b"> terms in the equation representing a restriction may be prefixed with a numeric multiplier, for example <@lit="3.5*b[4]">. 

Here is an example of a set of restrictions for a previously estimated model: 

<code>          
   restrict
    b[1] = 0
    b[2] - b[3] = 0
    b[4] + 2*b[5] = 1
   end restrict
</code>

And here is an example of a set of restrictions to be applied to a named system. (If the name of the system does not contain spaces, the surrounding quotes are not required.) 

<code>          
   restrict "System 1"
    b[1,1] = 0
    b[1,2] - b[2,2] = 0
    b[3,4] + 2*b[3,5] = 1
   end restrict
</code>

In the single-equation case the restrictions are by default evaluated via a Wald test, using the covariance matrix of the model in question. If the original model was estimated via OLS then the restricted coefficient estimates are printed; to suppress this, append the <@opt="--⁠quiet"> option flag to the initial <@lit="restrict"> command. As an alternative to the Wald test, for models estimated via OLS or WLS only, you can give the <@opt="--⁠bootstrap"> option to perform a bootstrapped test of the restriction. 

In the system case, the test statistic depends on the estimator chosen: a Likelihood Ratio test if the system is estimated using a Maximum Likelihood method, or an asymptotic <@mth="F">-test otherwise. 

There are two alternatives to the method of expressing restrictions discussed above. First, a set of <@mth="g"> linear restrictions on a <@mth="k">-vector of parameters, β, may be written compactly as <@mth="R">β – <@mth="q"> = 0, where <@mth="R"> is an <@itl="g">×<@itl="k"> matrix and <@mth="q"> is a <@mth="g">-vector. You can specify a restriction by giving the names of pre-defined, conformable matrices to be used as <@mth="R"> and <@mth="q">, as in 

<code>          
   restrict 
     R = Rmat
     q = qvec
   end restrict
</code>

Secondly, if you wish to test a nonlinear restriction (this is currently available for single-equation models only) you should give the restriction as the name of a function, preceded by "<@lit="rfunc = ">", as in 

<code>          
   restrict
     rfunc = myfunction
   end restrict
</code>

The constraint function should take a single <@lit="const matrix"> argument; this will be automatically filled out with the parameter vector. And it should return a vector which is zero under the null hypothesis, non-zero otherwise. The length of the vector is the number of restrictions. This function is used as a "callback" by gretl's numerical Jacobian routine, which calculates a Wald test statistic via the delta method. 

Here is a simple example of a function suitable for testing one nonlinear restriction, namely that two pairs of parameter values have a common ratio. 

<code>          
   function matrix restr (const matrix b)
     matrix v = b[1]/b[2] - b[4]/b[5]
     return v
   end function
</code>

On successful completion of the <@lit="restrict"> command the accessors <@lit="$test"> and <@lit="$pvalue"> give the test statistic and its p-value. 

When testing restrictions on a single-equation model estimated via OLS, or on a VECM, the <@opt="--⁠full"> option can be used to set the restricted estimates as the "last model" for the purposes of further testing or the use of accessors such as <@lit="$coeff"> and <@lit="$vcv">. Note that some special considerations apply in the case of testing restrictions on Vector Error Correction Models. Please see <@pdf="the Gretl User's Guide"> for details. 

Menu path: Model window, /Tests/Linear restrictions

# rmplot Graphs

Argument: 	<@var="series"> 
Options: 	<@lit="--trim"> (see below)
		<@lit="--quiet"> (suppress printed output)

Range–mean plot: this command creates a simple graph to help in deciding whether a time series, <@mth="y">(t), has constant variance or not. We take the full sample t=1,...,T and divide it into small subsamples of arbitrary size <@mth="k">. The first subsample is formed by <@mth="y">(1),...,<@mth="y">(k), the second is <@mth="y">(k+1), ..., <@mth="y">(2k), and so on. For each subsample we calculate the sample mean and range (= maximum minus minimum), and we construct a graph with the means on the horizontal axis and the ranges on the vertical. So each subsample is represented by a point in this plane. If the variance of the series is constant we would expect the subsample range to be independent of the subsample mean; if we see the points approximate an upward-sloping line this suggests the variance of the series is increasing in its mean; and if the points approximate a downward sloping line this suggests the variance is decreasing in the mean. 

Besides the graph, gretl displays the means and ranges for each subsample, along with the slope coefficient for an OLS regression of the range on the mean and the p-value for the null hypothesis that this slope is zero. If the slope coefficient is significant at the 10 percent significance level then the fitted line from the regression of range on mean is shown on the graph. The <@mth="t">-statistic for the null, and the corresponding p-value, are recorded and may be retrieved using the accessors <@lit="$test"> and <@lit="$pvalue"> respectively. 

If the <@opt="--⁠trim"> option is given, the minimum and maximum values in each sub-sample are discarded before calculating the mean and range. This makes it less likely that outliers will distort the analysis. 

If the <@opt="--⁠quiet"> option is given, no graph is shown and no output is printed; only the <@mth="t">-statistic and p-value are recorded. 

Menu path: /Variable/Range-mean graph

# run Programming

Argument: 	<@var="filename"> 

Executes the commands in <@var="filename"> then returns control to the interactive prompt. This command is intended for use with the command-line program gretlcli, or at the "gretl console" in the GUI program. 

See also <@ref="include">. 

Menu path: Run icon in script window

# runs Tests

Argument: 	<@var="series"> 
Options: 	<@lit="--difference"> (use first difference of variable)
		<@lit="--equal"> (positive and negative values are equiprobable)

Carries out the nonparametric "runs" test for randomness of the specified <@var="series">, where runs are defined as sequences of consecutive positive or negative values. If you want to test for randomness of deviations from the median, for a variable named <@lit="x1"> with a non-zero median, you can do the following: 

<code>          
   series signx1 = x1 - median(x1)
   runs signx1
</code>

If the <@opt="--⁠difference"> option is given, the variable is differenced prior to the analysis, hence the runs are interpreted as sequences of consecutive increases or decreases in the value of the variable. 

If the <@opt="--⁠equal"> option is given, the null hypothesis incorporates the assumption that positive and negative values are equiprobable, otherwise the test statistic is invariant with respect to the "fairness" of the process generating the sequence, and the test focuses on independence alone. 

Menu path: /Tools/Nonparametric tests

# scatters Graphs

Arguments: 	<@var="yvar"> ; <@var="xvars"> or <@var="yvars ; xvar"> 
Options: 	<@lit="--with-lines"> (create line graphs)
		<@lit="--matrix">=<@var="name"> (plot columns of named matrix)
		<@lit="--output">=<@var="filename"> (send output to specified file)
		<@lit="--output">=<@var="filename"> (send output to specified file)
Examples: 	<@lit="scatters 1 ; 2 3 4 5">
		<@lit="scatters 1 2 3 4 5 6 ; 7">
		<@lit="scatters y1 y2 y3 ; x --with-lines">

Generates pairwise graphs of <@var="yvar"> against all the variables in <@var="xvars">, or of all the variables in <@var="yvars"> against <@var="xvar">. The first example above puts variable 1 on the <@mth="y">-axis and draws four graphs, the first having variable 2 on the <@mth="x">-axis, the second variable 3 on the <@mth="x">-axis, and so on. The second example plots each of variables 1 through 6 against variable 7 on the <@mth="x">-axis. Scanning a set of such plots can be a useful step in exploratory data analysis. The maximum number of plots is 16; any extra variable in the list will be ignored. 

By default the graphs are scatterplots, but if you give the <@opt="--⁠with-lines"> flag they will be line graphs. 

For details on usage of the <@opt="--⁠output"> option, please see the <@ref="gnuplot"> command. 

If a named matrix is specified as the data source the <@var="x"> and <@var="y"> lists should be given as 1-based column numbers; or alternatively, if no such numbers are given, all the columns are plotted against time or an index variable. 

If the dataset is time-series, then the second sub-list can be omitted, in which case it will implicitly be taken as "time", so you can plot multiple time series in separated sub-graphs. 

Menu path: /View/Multiple graphs

# sdiff Transformations

Argument: 	<@var="varlist"> 

The seasonal difference of each variable in <@var="varlist"> is obtained and the result stored in a new variable with the prefix <@lit="sd_">. This command is available only for seasonal time series. 

Menu path: /Add/Seasonal differences of selected variables

# set Programming

Variants: 	<@lit="set"> <@var="variable"> <@var="value">
		<@lit="set --to-file="><@var="filename">
		<@lit="set --from-file="><@var="filename">
		<@lit="set stopwatch">
		<@lit="set">
Examples: 	<@lit="set svd on">
		<@lit="set csv_delim tab">
		<@lit="set horizon 10">
		<@lit="set --to-file=mysettings.inp">

The most common use of this command is the first variant shown above, where it is used to set the value of a selected program parameter. This is discussed in detail below. The other uses are: with <@opt="--⁠to-file">, to write a script file containing all the current parameter settings; with <@opt="--⁠from-file"> to read a script file containing parameter settings and apply them to the current session; with <@lit="stopwatch"> to zero the gretl "stopwatch" which can be used to measure CPU time (see the entry for the <@lit="$stopwatch"> accessor in the gretl function reference); or, if the word <@lit="set"> is given alone, to print the current settings. 

Values set via this comand remain in force for the duration of the gretl session unless they are changed by a further call to <@lit="set">. The parameters that can be set in this way are enumerated below. Note that the settings of <@lit="hc_version">, <@lit="hac_lag"> and <@lit="hac_kernel"> are used when the <@opt="--⁠robust"> option is given to an estimation command. 

The available settings are grouped under the following categories: program interaction and behavior, numerical methods, random number generation, robust estimation, filtering, time series estimation, and interaction with GNU R. 

<@itl="Program interaction and behavior"> 

These settings are used for controlling various aspects of the way gretl interacts with the user. 

<indent>
• <@lit="csv_delim">: either <@lit="comma"> (the default), <@lit="space">, <@lit="tab"> or <@lit="semicolon">. Sets the column delimiter used when saving data to file in CSV format. 
</indent>

<indent>
• <@lit="csv_write_na">: the string used to represent missing values when writing data to file in CSV format. Maximum 7 characters; the default is <@lit="NA">. 
</indent>

<indent>
• <@lit="csv_read_na">: the string taken to represent missing values (NAs) when reading data in CSV format. Maximum 7 characters. The default depends on whether a data column is found to contain numerical data (mostly) or string values. For numerical data the following are taken as indicating NAs: an empty cell, or any of the strings <@lit="NA">, <@lit="N.A.">, <@lit="na">, <@lit="n.a.">, <@lit="N/A">, <@lit="#N/A">, <@lit="NaN">, <@lit=".NaN">, <@lit=".">, <@lit="..">, <@lit="-999">, and <@lit="-9999">. For string-valued data only a blank cell, or a cell containing an empty string, is counted as NA. These defaults can be reimposed by giving <@lit="default"> as the value for <@lit="csv_read_na">. To specify that only empty cells are read as NAs, give a value of <@lit="""">. Note that empty cells are always read as NAs regardless of the setting of this variable. 
</indent>

<indent>
• <@lit="csv_digits">: a positive integer specifying the number of significant digits to use when writing data in CSV format. By default up to 15 digits are used depending on the precision of the original data. Note that CSV output employs the C library's <@lit="fprintf"> function with "<@lit="%g">" conversion, which means that trailing zeros are dropped. 
</indent>

<indent>
• <@lit="mwrite_g">: <@lit="on"> or <@lit="off"> (the default). When writing a matrix to file as text, gretl by default uses scientific notation with 18-digit precision, hence ensuring that the stored values are a faithful representation of the numbers in memory. When writing primary data with no more than 6 digits of precision it may be preferable to use <@lit="%g"> format for a more compact and human-readable file; you can make this switch via <@lit="set mwrite_g on">. 
</indent>

<indent>
• <@lit="echo">: <@lit="off"> or <@lit="on"> (the default). Suppress or resume the echoing of commands in gretl's output. 
</indent>

<indent>
• <@lit="force_decpoint">: <@lit="on"> or <@lit="off"> (the default). Force gretl to use the decimal point character, in a locale where another character (most likely the comma) is the standard decimal separator. 
</indent>

<indent>
• <@lit="loop_maxiter">: one non-negative integer value (default 100000). Sets the maximum number of iterations that a <@lit="while"> loop is allowed before halting (see <@ref="loop">). Note that this setting only affects the <@lit="while"> variant; its purpose is to guard against inadvertently infinite loops. Setting this value to 0 has the effect of disabling the limit; use with caution. 
</indent>

<indent>
• <@lit="max_verbose">: <@lit="on"> or <@lit="off"> (the default). Toggles verbose output for the <@lit="BFGSmax"> and <@lit="NRmax"> functions (see the User's Guide for details). 
</indent>

<indent>
• <@lit="messages">: <@lit="off"> or <@lit="on"> (the default). Suppress or resume the printing of non-error messages associated with various commands, for example when a new variable is generated or when the sample range is changed. 
</indent>

<indent>
• <@lit="warnings">: <@lit="off"> or <@lit="on"> (the default). Suppress or resume the printing of warning messages issued when arithmetical operations produce non-finite values. 
</indent>

<indent>
• <@lit="debug">: <@lit="1">, <@lit="2"> or <@lit="0"> (the default). This is for use with user-defined functions. Setting <@lit="debug"> to 1 is equivalent to turning <@lit="messages"> on within all such functions; setting this variable to <@lit="2"> has the additional effect of turning on <@lit="max_verbose"> within all functions. 
</indent>

<indent>
• <@lit="shell_ok">: <@lit="on"> or <@lit="off"> (the default). Enable launching external programs from gretl via the system shell. This is disabled by default for security reasons, and can only be enabled via the graphical user interface (Tools/Preferences/General). However, once set to on, this setting will remain active for future sessions until explicitly disabled. 
</indent>

<indent>
• <@lit="shelldir">: <@var="path">. Sets the current working directory for shell commands. 
</indent>

<indent>
• <@lit="use_cwd">: <@lit="on"> or <@lit="off"> (the default). This setting affects the behavior of the <@ref="outfile"> and <@ref="store"> commands, which write external files. Normally, the file will be written in the user's default data directory; if <@lit="use_cwd"> is <@lit="on">, on the contrary, the file will be created in the working directory when gretl was started. 
</indent>

<indent>
• <@lit="bfgs_verbskip">: one integer. This setting affects the behavior of the <@opt="--⁠verbose"> option to those commands that use BFGS as an optimization algorithm and is used to compact output. if <@lit="bfgs_verbskip"> is set to, say, 3, then the <@opt="--⁠verbose"> switch will only print iterations 3, 6, 9 and so on. 
</indent>

<indent>
• <@lit="skip_missing">: <@lit="on"> (the default) or <@lit="off">. Controls gretl's behavior when contructing a matrix from data series: the default is to skip data rows that contain one or more missing values but if <@lit="skip_missing"> is set <@lit="off"> missing values are converted to NaNs. 
</indent>

<indent>
• <@lit="matrix_mask">: the name of a series, or the keyword <@lit="null">. Offers greater control than <@lit="skip_missing"> when constructing matrices from series: the data rows selected for matrices are those with non-zero (and non-missing) values in the specified series. The selected mask remains in force until it is replaced, or removed via the <@lit="null"> keyword. 
</indent>

<indent>
• <@lit="huge">: a large positive number (by default, 1.0E100). This setting controls the value returned by the accessor <@xrf="$huge">. 
</indent>

<@itl="Numerical methods"> 

These settings are used for controlling the numerical algorithms that gretl uses for estimation. 

<indent>
• <@lit="optimizer">: either <@lit="auto"> (the default), <@lit="BFGS"> or <@lit="newton">. Sets the optimization algorithm used for various ML estimators, in cases where both BFGS and Newton–Raphson are applicable. The default is to use Newton–Raphson where an analytical Hessian is available, otherwise BFGS. 
</indent>

<indent>
• <@lit="bhhh_maxiter">: one integer, the maximum number of iterations for gretl's internal BHHH routine, which is used in the <@lit="arma"> command for conditional ML estimation. If convergence is not achieved after <@lit="bhhh_maxiter">, the program returns an error. The default is set at 500. 
</indent>

<indent>
• <@lit="bhhh_toler">: one floating point value, or the string <@lit="default">. This is used in gretl's internal BHHH routine to check if convergence has occurred. The algorithm stops iterating as soon as the increment in the log-likelihood between iterations is smaller than <@lit="bhhh_toler">. The default value is 1.0E–06; this value may be re-established by typing <@lit="default"> in place of a numeric value. 
</indent>

<indent>
• <@lit="bfgs_maxiter">: one integer, the maximum number of iterations for gretl's BFGS routine, which is used for <@lit="mle">, <@lit="gmm"> and several specific estimators. If convergence is not achieved in the specified number of iterations, the program returns an error. The default value depends on the context, but is typically of the order of 500. 
</indent>

<indent>
• <@lit="bfgs_toler">: one floating point value, or the string <@lit="default">. This is used in gretl's BFGS routine to check if convergence has occurred. The algorithm stops as soon as the relative improvement in the objective function between iterations is smaller than <@lit="bfgs_toler">. The default value is the machine precision to the power 3/4; this value may be re-established by typing <@lit="default"> in place of a numeric value. 
</indent>

<indent>
• <@lit="bfgs_maxgrad">: one floating point value. This is used in gretl's BFGS routine to check if the norm of the gradient is reasonably close to zero when the <@lit="bfgs_toler"> criterion is met. A warning is printed if the norm of the gradient exceeds 1; an error is flagged if the norm exceeds <@lit="bfgs_maxgrad">. At present the default is the permissive value of 5.0. 
</indent>

<indent>
• <@lit="bfgs_richardson">: <@lit="on"> or <@lit="off"> (the default). Use Richardson extrapolation when computing numerical derivatives in the context of BFGS maximization. 
</indent>

<indent>
• <@lit="initvals">: either <@lit="auto"> (the default) or the name of a pre-specified matrix. Allows manual setting of the initial parameter estimates for numerical optimization problems (such as ARMA estimation). For details see <@pdf="the Gretl User's Guide">. 
</indent>

<indent>
• <@lit="lbfgs">: <@lit="on"> or <@lit="off"> (the default). Use the limited-memory version of BFGS (L-BFGS-B) instead of the ordinary algorithm. This may be advantageous when the function to be maximized is not globally concave. 
</indent>

<indent>
• <@lit="lbfgs_mem">: an integer value in the range 3 to 20 (with a default value of 8). This determines the number of corrections used in the limited memory matrix when L-BFGS-B is employed. 
</indent>

<indent>
• <@lit="nls_toler">: a floating-point value (the default is the machine precision to the power 3/4). Sets the tolerance used in judging whether or not convergence has occurred in nonlinear least squares estimation using the <@ref="nls"> command. 
</indent>

<indent>
• <@lit="svd">: <@lit="on"> or <@lit="off"> (the default). Use SVD rather than Cholesky or QR decomposition in least squares calculations. This option applies to the <@lit="mols"> function as well as various internal calculations, but not to the regular <@ref="ols"> command. 
</indent>

<indent>
• <@lit="fcp">: <@lit="on"> or <@lit="off"> (the default). Use the algorithm of Fiorentini, Calzolari and Panattoni rather than native gretl code when computing GARCH estimates. 
</indent>

<indent>
• <@lit="gmm_maxiter">: one integer, the maximum number of iterations for gretl's <@ref="gmm"> command when in iterated mode (as opposed to one- or two-step). The default value is 250. 
</indent>

<indent>
• <@lit="nadarwat_trim">: one integer, the trim parameter used in the <@xrf="nadarwat"> function. 
</indent>

<indent>
• <@lit="fdjac_quality">: one integer between 0 and 2, the algorithm used by the <@xrf="fdjac"> function. 
</indent>

<@itl="Random number generation"> 

<indent>
• <@lit="seed">: an unsigned integer. Sets the seed for the pseudo-random number generator. By default this is set from the system time; if you want to generate repeatable sequences of random numbers you must set the seed manually. 
</indent>

<indent>
• <@lit="normal_rand">: <@lit="ziggurat"> (the default) or <@lit="box-muller">. Sets the method for generating random normal samples based on uniform input. 
</indent>

<@itl="Robust estimation"> 

<indent>
• <@lit="bootrep">: an integer. Sets the number of replications for the <@ref="restrict"> command with the <@opt="--⁠bootstrap"> option. 
</indent>

<indent>
• <@lit="garch_vcv">: <@lit="unset">, <@lit="hessian">, <@lit="im"> (information matrix) , <@lit="op"> (outer product matrix), <@lit="qml"> (QML estimator), <@lit="bw"> (Bollerslev–Wooldridge). Specifies the variant that will be used for estimating the coefficient covariance matrix, for GARCH models. If <@lit="unset"> is given (the default) then the Hessian is used unless the "robust" option is given for the garch command, in which case QML is used. 
</indent>

<indent>
• <@lit="arma_vcv">: <@lit="hessian"> (the default) or <@lit="op"> (outer product matrix). Specifies the variant to be used when computing the covariance matrix for ARIMA models. 
</indent>

<indent>
• <@lit="force_hc">: <@lit="off"> (the default) or <@lit="on">. By default, with time-series data and when the <@opt="--⁠robust"> option is given with <@lit="ols">, the HAC estimator is used. If you set <@lit="force_hc"> to "on", this forces calculation of the regular Heteroskedasticity Consistent Covariance Matrix (HCCM), which does not take autocorrelation into account. Note that VARs are treated as a special case: when the <@opt="--⁠robust"> option is given the default method is regular HCCM, but the <@opt="--⁠robust-hac"> flag can be used to force the use of a HAC estimator. 
</indent>

<indent>
• <@lit="robust_z">: <@lit="off"> (the default) or <@lit="on">. This controls the distribution used when calculating p-values based on robust standard errors in the context of least-squares estimators. By default gretl uses the Student <@mth="t"> distribution but if <@lit="robust_z"> is turned on the normal distribution is used. 
</indent>

<indent>
• <@lit="hac_lag">: <@lit="nw1"> (the default), <@lit="nw2">, <@lit="nw3"> or an integer. Sets the maximum lag value or bandwidth, <@mth="p">, used when calculating HAC (Heteroskedasticity and Autocorrelation Consistent) standard errors using the Newey-West approach, for time series data. <@lit="nw1"> and <@lit="nw2"> represent two variant automatic calculations based on the sample size, <@mth="T">: for nw1, <@fig="nw1">, and for nw2, <@fig="nw2">. <@lit="nw3"> calls for data-based bandwidth selection. See also <@lit="qs_bandwidth"> and <@lit="hac_prewhiten"> below. 
</indent>

<indent>
• <@lit="hac_kernel">: <@lit="bartlett"> (the default), <@lit="parzen">, or <@lit="qs"> (Quadratic Spectral). Sets the kernel, or pattern of weights, used when calculating HAC standard errors. 
</indent>

<indent>
• <@lit="hac_prewhiten">: <@lit="on"> or <@lit="off"> (the default). Use Andrews-Monahan prewhitening and re-coloring when computing HAC standard errors. This also implies use of data-based bandwidth selection. 
</indent>

<indent>
• <@lit="hc_version">: 0 (the default), 1, 2, 3 or 3a. Sets the variant used when calculating Heteroskedasticity Consistent standard errors with cross-sectional data. The first four options correspond to the HC0, HC1, HC2 and HC3 discussed by Davidson and MacKinnon in <@itl="Econometric Theory and Methods">, chapter 5. HC0 produces what are usually called "White's standard errors". Variant 3a is the MacKinnon–White "jackknife" procedure. 
</indent>

<indent>
• <@lit="pcse">: <@lit="off"> (the default) or <@lit="on">. By default, when estimating a model using pooled OLS on panel data with the <@opt="--⁠robust"> option, the Arellano estimator is used for the covariance matrix. If you set <@lit="pcse"> to "on", this forces use of the Beck and Katz Panel Corrected Standard Errors (which do not take autocorrelation into account). 
</indent>

<indent>
• <@lit="qs_bandwidth">: Bandwidth for HAC estimation in the case where the Quadratic Spectral kernel is selected. (Unlike the Bartlett and Parzen kernels, the QS bandwidth need not be an integer.) 
</indent>

<@itl="Time series"> 

<indent>
• <@lit="horizon">: one integer (the default is based on the frequency of the data). Sets the horizon for impulse responses and forecast variance decompositions in the context of vector autoregressions. 
</indent>

<indent>
• <@lit="vecm_norm">: <@lit="phillips"> (the default), <@lit="diag">, <@lit="first"> or <@lit="none">. Used in the context of VECM estimation via the <@ref="vecm"> command for identifying the cointegration vectors. See the <@pdf="the Gretl User's Guide"> for details. 
</indent>

<@itl="Interaction with R"> 

<indent>
• <@lit="R_lib">: <@lit="on ">(the default) or <@lit="off">. When sending instructions to be executed by R, use the R shared library by preference to the R executable, if the library is available. 
</indent>

<indent>
• <@lit="R_functions">: <@lit="off"> (the default) or <@lit="on">. Recognize functions defined in R as if they were native functions (the namespace prefix "<@lit="R.">" is required). See <@pdf="the Gretl User's Guide"> for details on this and the previous item. 
</indent>

# setinfo Dataset

Argument: 	<@var="series"> 
Options: 	<@lit="--description">=<@var="string"> (set description)
		<@lit="--graph-name">=<@var="string"> (set graph name)
		<@lit="--discrete"> (mark series as discrete)
		<@lit="--continuous"> (mark series as continuous)
Examples: 	<@lit="setinfo x1 --description="Description of x1"">
		<@lit="setinfo y --graph-name="Some string"">
		<@lit="setinfo z --discrete">

Sets up to three attributes of <@var="series">, given by name or ID number, as follows. 

If the <@opt="--⁠description"> flag is given followed by a string in double quotes, that string is used to set the variable's descriptive label. This label is shown in response to the <@ref="labels"> command, and is also shown in the main window of the GUI program. 

If the <@opt="--⁠graph-name"> flag is given followed by a quoted string, that string will be used in place of the variable's name in graphs. 

If one or other of the <@opt="--⁠discrete"> or <@opt="--⁠continuous"> option flags is given, the variable's numerical character is set accordingly. The default is to treat all series as continuous; setting a series as discrete affects the way the variable is handled in frequency plots. 

Menu path: /Variable/Edit attributes
Other access: Main window pop-up menu

# setmiss Dataset

Arguments: 	<@var="value"> [ <@var="varlist"> ] 
Examples: 	<@lit="setmiss -1">
		<@lit="setmiss 100 x2">

Get the program to interpret some specific numerical data value (the first parameter to the command) as a code for "missing", in the case of imported data. If this value is the only parameter, as in the first example above, the interpretation will be applied to all series in the data set. If <@var="value"> is followed by a list of variables, by name or number, the interpretation is confined to the specified variable(s). Thus in the second example the data value 100 is interpreted as a code for "missing", but only for the variable <@lit="x2">. 

Menu path: /Data/Set missing value code

# setobs Dataset

Variants: 	<@lit="setobs"> <@var="periodicity"> <@var="startobs">
		<@lit="setobs"> <@var="unitvar"> <@var="timevar"> <@lit="--panel-vars">
Options: 	<@lit="--cross-section"> (interpret as cross section)
		<@lit="--time-series"> (interpret as time series)
		<@lit="--stacked-cross-section"> (interpret as panel data)
		<@lit="--stacked-time-series"> (interpret as panel data)
		<@lit="--panel-vars"> (use index variables, see below)
		<@lit="--panel-time"> (see below)
		<@lit="--panel-groups"> (see below)
Examples: 	<@lit="setobs 4 1990:1 --time-series">
		<@lit="setobs 12 1978:03">
		<@lit="setobs 1 1 --cross-section">
		<@lit="setobs 20 1:1 --stacked-time-series">
		<@lit="setobs unit year --panel-vars">

This command forces the program to interpret the current data set as having a specified structure. 

In the first form of the command the <@var="periodicity">, which must be an integer, represents frequency in the case of time-series data (1 = annual; 4 = quarterly; 12 = monthly; 52 = weekly; 5, 6, or 7 = daily; 24 = hourly). In the case of panel data the periodicity means the number of lines per data block: this corresponds to the number of cross-sectional units in the case of stacked cross-sections, or the number of time periods in the case of stacked time series. In the case of simple cross-sectional data the periodicity should be set to 1. 

The starting observation represents the starting date in the case of time series data. Years may be given with two or four digits; subperiods (for example, quarters or months) should be separated from the year with a colon. In the case of panel data the starting observation should be given as 1:1; and in the case of cross-sectional data, as 1. Starting observations for daily or weekly data should be given in the form YYYY-MM-DD (or simply as 1 for undated data). 

If no explicit option flag is given to indicate the structure of the data the program will attempt to guess the structure from the information given. 

The second form of the command (which requires the <@opt="--⁠panel-vars"> flag) may be used to impose a panel interpretation when the data set contains variables that uniquely identify the cross-sectional units and the time periods. The data set will be sorted as stacked time series, by ascending values of the units variable, <@var="unitvar">. 

<@itl="Panel-specific options"> 

The <@opt="--⁠panel-time"> and <@opt="--⁠panel-groups"> options can only be used with a dataset which has already been defined as a panel. 

The purpose of <@opt="--⁠panel-time"> is to set extra information regarding the time dimension of the panel. This should be given on the pattern of the first form of <@lit="setobs"> noted above. For example, the following may be used to indicate that the time dimension of a panel is quarterly, starting in the first quarter of 1990. 

<code>          
   setobs 4 1990:1 --panel-time
</code>

The purpose of <@opt="--⁠panel-groups"> is to create a string-valued series holding names for the groups (individuals, cross-sectional units) in the panel. (This will be used where appropriate in panel graphs.) With this option you supply either one or two arguments as follows. 

First case: the (single) argument is the name of a string-valued series. If the number of distinct values equals the number of groups in the panel this series is used to define the group names. If necessary, the numerical content of the series will be adjusted such that the values are all 1s for the first group, all 2s for the second, and so on. If the number of string values doesn't match the number of groups an error is flagged. 

Second case: the first argument is the name of a series and the second is a string literal or variable holding a name for each group. The series will be created if it does not already exist. If the second argument is a string literal or string variable the group names should be separated by spaces; if a name includes spaces it should be wrapped in backslash-escaped double-quotes. Alternatively the second argument may be an array of strings. 

For example, the following will create a series named <@lit="country"> in which the names in <@lit="cstrs"> are each repeated <@mth="T"> times, <@mth="T"> being the time-series length of the panel. 

<code>          
   string cstrs = sprintf("France Germany Italy \"United Kingdom\"")
   setobs country cstrs --panel-groups
</code>

Menu path: /Data/Dataset structure

# setopt Programming

Arguments: 	<@var="command"> [ <@var="action"> ] <@var="options"> 
Examples: 	<@lit="setopt mle --hessian">
		<@lit="setopt ols persist --quiet">
		<@lit="setopt ols clear">

This command enables the pre-setting of options for a specified command. Ordinarily this is not required, but it may be useful for the writers of hansl functions when they wish to make certain command options conditional on the value of an argument supplied by the caller. 

For example, suppose a function offers a boolean "<@lit="quiet">" switch, whose intended effect is to suppress the printing of results from a certain regression executed within the function. In that case one might write: 

<code>          
   if quiet
     setopt ols --quiet
   endif
   ols ...
</code>

The <@opt="--⁠quiet"> option will then be applied to the next <@lit="ols"> command if and only if the variable <@lit="quiet"> has a non-zero value. 

By default, options set in this way apply only to the following instance of <@var="command">; they are not persistent. However if you give <@lit="persist"> as the value for <@var="action"> the options will continue to apply to the given command until further notice. The antidote to the <@lit="persist"> action is <@lit="clear">: this erases any stored setting for the specified command. 

It should be noted that options set via <@lit="setopt"> are compounded with any options attached to the target command directly. So for example one might append the <@opt="--⁠hessian"> option to an <@lit="mle"> command unconditionally but use <@lit="setopt"> to add <@opt="--⁠quiet"> conditionally. 

# shell Utilities

Argument: 	<@var="shellcommand"> 
Examples: 	<@lit="! ls -al">
		<@lit="! notepad">
		<@lit="launch notepad">

An exclamation mark, <@lit="!">, or the keyword <@lit="launch">, at the beginning of a command line is interpreted as an escape to the user's shell. Thus arbitrary shell commands can be executed from within gretl. When <@lit="!"> is used, the external command is executed synchronously. That is, gretl waits for it to complete before proceeding. If you want to start another program from within gretl and not wait for its completion (asynchronous operation), use <@lit="launch"> instead. 

For reasons of security this facility is not enabled by default. To activate it, check the box titled "Allow shell commands" under the File, Preferences menu in the GUI program. This also makes shell commands available in the command-line program (and is the only way to do so). 

# smpl Dataset

Variants: 	<@lit="smpl"> <@var="startobs endobs">
		<@lit="smpl"> <@var="+i -j">
		<@lit="smpl"> <@var="dumvar"> <@lit="--dummy">
		<@lit="smpl"> <@var="condition"> <@lit="--restrict">
		<@lit="smpl"> <@lit="--no-missing [ "><@var="varlist"> <@lit="]">
		<@lit="smpl"> <@lit="--no-all-missing [ "><@var="varlist"> <@lit="]">
		<@lit="smpl"> <@lit="--contiguous [ "><@var="varlist"> <@lit="]">
		<@lit="smpl"> <@var="n"> <@lit="--random">
		<@lit="smpl full">
Options: 	<@lit="--dummy"> (argument is a dummy variable)
		<@lit="--restrict"> (apply boolean restriction)
		<@lit="--replace"> (replace any existing boolean restriction)
		<@lit="--no-missing"> (restrict to valid observations)
		<@lit="--no-all-missing"> (omit empty observations (see below))
		<@lit="--contiguous"> (see below)
		<@lit="--random"> (form random sub-sample)
		<@lit="--permanent"> (see below)
		<@lit="--balanced"> (panel data: try to retain balanced panel)
Examples: 	<@lit="smpl 3 10">
		<@lit="smpl 1960:2 1982:4">
		<@lit="smpl +1 -1">
		<@lit="smpl x > 3000 --restrict">
		<@lit="smpl y > 3000 --restrict --replace">
		<@lit="smpl 100 --random">

Resets the sample range. The new range can be defined in several ways. In the first alternate form (and the first two examples) above, <@var="startobs"> and <@var="endobs"> must be consistent with the periodicity of the data. Either one may be replaced by a semicolon to leave the value unchanged. In the second form, the integers <@var="i"> and <@var="j"> (which may be positive or negative, and should be signed) are taken as offsets relative to the existing sample range. In the third form <@var="dummyvar"> must be an indicator variable with values 0 or 1 at each observation; the sample will be restricted to observations where the value is 1. The fourth form, using <@opt="--⁠restrict">, restricts the sample to observations that satisfy the given Boolean condition (which is specified according to the syntax of the <@ref="genr"> command). 

The options <@opt="--⁠no-missing"> and <@opt="--⁠no-all-missing"> may be used to exclude from the sample observations for which data are missing. The first variant excludes those rows in the dataset for which at least one variable has a missing value, while the second excludes just those rows on which <@itl="all"> variables have missing values. In each case the test is confined to the variables in <@var="varlist"> if this argument is given, otherwise it is applied to all series—with the qualification that in the case of <@opt="--⁠no-all-missing"> and no <@var="varlist">, the generic variables <@lit="index"> and <@lit="time"> are ignored. 

The <@opt="--⁠contiguous"> form of <@lit="smpl"> is intended for use with time series data. The effect is to trim any observations at the start and end of the current sample range that contain missing values (either for the variables in <@var="varlist">, or for all data series if no <@var="varlist"> is given). Then a check is performed to see if there are any missing values in the remaining range; if so, an error is flagged. 

With the <@opt="--⁠random"> flag, the specified number of cases are selected from the current dataset at random (without replacement). If you wish to be able to replicate this selection you should set the seed for the random number generator first (see the <@ref="set"> command). 

The final form, <@lit="smpl full">, restores the full data range. 

Note that sample restrictions are, by default, cumulative: the baseline for any <@lit="smpl"> command is the current sample. If you wish the command to act so as to replace any existing restriction you can add the option flag <@opt="--⁠replace"> to the end of the command. (But this option is not compatible with the <@opt="--⁠contiguous"> option.) 

The internal variable <@lit="obs"> may be used with the <@opt="--⁠restrict"> form of <@lit="smpl"> to exclude particular observations from the sample. For example 

<code>          
   smpl obs!=4 --restrict
</code>

will drop just the fourth observation. If the data points are identified by labels, 

<code>          
   smpl obs!="USA" --restrict
</code>

will drop the observation with label "USA". 

One point should be noted about the <@opt="--⁠dummy">, <@opt="--⁠restrict"> and <@opt="--⁠no-missing"> forms of <@lit="smpl">: "structural" information in the data file (regarding the time series or panel nature of the data) is likely to be lost when this command is issued. You may reimpose structure with the <@ref="setobs"> command. A related option, for use with panel data, is the <@opt="--⁠balanced"> flag: this requests that a balanced panel is reconstituted after sub-sampling, via the insertion of "missing rows" if need be. But note that it is not always possible to comply with this request. 

By default, restrictions on the current sample range are undoable: by doing <@lit="smpl full"> you can restore the unrestricted dataset. However, the <@opt="--⁠permanent"> flag can be used to substitute the restricted dataset for the original. This option is only available in conjunction with the <@opt="--⁠restrict">, <@opt="--⁠dummy">, <@opt="--⁠no-missing">, <@opt="--⁠no-all-missing"> or <@opt="--⁠random"> forms of <@lit="smpl">. 

Please see <@pdf="the Gretl User's Guide"> for further details. 

Menu path: /Sample

# spearman Statistics

Arguments: 	<@var="series1"> <@var="series2"> 
Option: 	<@lit="--verbose"> (print ranked data)

Prints Spearman's rank correlation coefficient for the series <@var="series1"> and <@var="series2">. The variables do not have to be ranked manually in advance; the function takes care of this. 

The automatic ranking is from largest to smallest (i.e. the largest data value gets rank 1). If you need to invert this ranking, create a new variable which is the negative of the original. For example: 

<code>          
   series altx = -x
   spearman altx y
</code>

Menu path: /Model/Robust estimation/Rank correlation

# sprintf Printing

Arguments: 	<@var="stringvar"> <@var="format"> <@lit=", "><@var="args"> 

This command works exactly like the <@ref="printf"> command, printing the given arguments under the control of the format string, except that the result is written into the named string, <@var="stringvar">. 

# square Transformations

Argument: 	<@var="varlist"> 
Option: 	<@lit="--cross"> (generate cross-products as well as squares)

Generates new series which are squares of the series in <@var="varlist"> (plus cross-products if the <@opt="--⁠cross"> option is given). For example, <@lit="square x y"> will generate <@lit="sq_x"> = <@lit="x"> squared, <@lit="sq_y"> = <@lit="y"> squared and (optionally) <@lit="x_y"> = <@lit="x"> times <@lit="y">. If a particular variable is a dummy variable it is not squared because we will get the same variable. 

Menu path: /Add/Squares of selected variables

# store Dataset

Arguments: 	<@var="filename"> [ <@var="varlist"> ] 
Options: 	<@lit="--csv"> (use CSV format)
		<@lit="--omit-obs"> (see below, on CSV format)
		<@lit="--no-header"> (see below, on CSV format)
		<@lit="--gnu-octave"> (use GNU Octave format)
		<@lit="--gnu-R"> (use GNU R format)
		<@lit="--gzipped">[=<@var="level">] (apply gzip compression)
		<@lit="--jmulti"> (use JMulti ASCII format)
		<@lit="--dat"> (use PcGive ASCII format)
		<@lit="--decimal-comma"> (use comma as decimal character)
		<@lit="--database"> (use gretl database format)
		<@lit="--overwrite"> (see below, on database format)
		<@lit="--comment">=<@var="string"> (see below)

Save data to <@var="filename">. By default all currently defined series are saved but the optional <@var="varlist"> argument can be used to select a subset of series. If the dataset is sub-sampled, only the observations in the current sample range are saved. 

The format in which the data are written may be controlled in the first instance by the extension or suffix of <@var="filename">, as follows: 

<indent>
• <@lit=".gdt">, or no extension: gretl's native XML data format. (If no extension is provided, "<@lit=".gdt">" is added automatically.) 
</indent>

<indent>
• <@lit=".gtdb">: gretl's native binary data format. 
</indent>

<indent>
• <@lit=".csv">: comma-separated values (CSV). 
</indent>

<indent>
• <@lit=".txt"> or <@lit=".asc">: space-separated values. 
</indent>

<indent>
• <@lit=".R">: GNU R format. 
</indent>

<indent>
• <@lit=".m">: GNU Octave format. 
</indent>

The format-related option flags shown above can be used to force the issue of the save format independently of the filename (or to get gretl to write in the formats of PcGive or JMulTi). However, if <@var="filename"> has extension <@lit=".gdt"> or <@lit=".gdtb"> this necessarily implies use of native format and the addition of a conflicting option flag will generate an error. 

When data are saved in native format (only), the <@opt="--⁠gzipped"> option may be used for data compression, which can be useful for large datasets. The optional parameter for this flag controls the level of compression (from 0 to 9): higher levels produce a smaller file, but compression takes longer. The default level is 1; a level of 0 means that no compression is applied. 

The option flags <@opt="--⁠omit-obs"> and <@opt="--⁠no-header"> are applicable only when saving data in CSV format. By default, if the data are time series or panel, or if the dataset includes specific observation markers, the CSV file includes a first column identifying the observations (e.g. by date). If the <@opt="--⁠omit-obs"> flag is given this column is omitted. The <@opt="--⁠no-header"> flag suppresses the usual printing of the names of the variables at the top of the columns. 

The option flag <@opt="--⁠decimal-comma"> is also confined to the case of saving data in CSV format. The effect of this option is to replace the decimal point with the decimal comma; in addition the column separator is forced to be a semicolon. 

The option of saving in gretl database format is intended to help with the construction of large sets of series, possibly having mixed frequencies and ranges of observations. At present this option is available only for annual, quarterly or monthly time-series data. If you save to a file that already exists, the default action is to append the newly saved series to the existing content of the database. In this context it is an error if one or more of the variables to be saved has the same name as a variable that is already present in the database. The <@opt="--⁠overwrite"> flag has the effect that, if there are variable names in common, the newly saved variable replaces the variable of the same name in the original dataset. 

The <@opt="--⁠comment"> option is available when saving data as a database or in CSV format. The required parameter is a double-quoted one-line string, attached to the option flag with an equals sign. The string is inserted as a comment into the database index file or at the top of the CSV output. 

The <@lit="store"> command behaves in a special manner in the context of a "progressive loop". See <@pdf="the Gretl User's Guide"> for details. 

Menu path: /File/Save data; /File/Export data

# summary Statistics

Variants: 	<@lit="summary ["> <@var="varlist"> ]
		<@lit="summary --matrix="><@var="matname">
Options: 	<@lit="--simple"> (basic statistics only)
		<@lit="--weight">=<@var="wvar"> (weighting variable)
		<@lit="--by">=<@var="byvar"> (see below)

In its first form, this command prints summary statistics for the variables in <@var="varlist">, or for all the variables in the data set if <@var="varlist"> is omitted. By default, output consists of the mean, standard deviation (sd), coefficient of variation (= sd/mean), median, minimum, maximum, skewness coefficient, and excess kurtosis. If the <@opt="--⁠simple"> option is given, output is restricted to the mean, minimum, maximum and standard deviation. 

If the <@opt="--⁠by"> option is given (in which case the parameter <@var="byvar"> should be the name of a discrete variable), then statistics are printed for sub-samples corresponding to the distinct values taken on by <@var="byvar">. For example, if <@var="byvar"> is a (binary) dummy variable, statistics are given for the cases <@lit="byvar = 0"> and <@lit="byvar = 1">. Note: at present, this option is incompatible with the <@opt="--⁠weight"> option. 

If the alternative form is given, using a named matrix, then summary statistics are printed for each column of the matrix. The <@opt="--⁠by"> option is not available in this case. 

Menu path: /View/Summary statistics
Other access: Main window pop-up menu

# system Estimation

Variants: 	<@lit="system method="><@var="estimator">
		<@var="sysname"><@lit=" <- system">
Examples: 	<@lit=""Klein Model 1" <- system">
		<@lit="system method=sur">
		<@lit="system method=3sls">
		See also <@inp="klein.inp">, <@inp="kmenta.inp">, <@inp="greene14_2.inp">

Starts a system of equations. Either of two forms of the command may be given, depending on whether you wish to save the system for estimation in more than one way or just estimate the system once. 

To save the system you should assign it a name, as in the first example (if the name contains spaces it must be surrounded by double quotes). In this case you estimate the system using the <@ref="estimate"> command. With a saved system of equations, you are able to impose restrictions (including cross-equation restrictions) using the <@ref="restrict"> command. 

Alternatively you can specify an estimator for the system using <@lit="method="> followed by a string identifying one of the supported estimators: <@lit="ols"> (Ordinary Least Squares), <@lit="tsls"> (Two-Stage Least Squares) <@lit="sur"> (Seemingly Unrelated Regressions), <@lit="3sls"> (Three-Stage Least Squares), <@lit="fiml"> (Full Information Maximum Likelihood) or <@lit="liml"> (Limited Information Maximum Likelihood). In this case the system is estimated once its definition is complete. 

An equation system is terminated by the line <@lit="end system">. Within the system four sorts of statement may be given, as follows. 

<indent>
• <@ref="equation">: specify an equation within the system. At least two such statements must be provided. 
</indent>

<indent>
• <@lit="instr">: for a system to be estimated via Three-Stage Least Squares, a list of instruments (by variable name or number). Alternatively, you can put this information into the <@lit="equation"> line using the same syntax as in the <@ref="tsls"> command. 
</indent>

<indent>
• <@lit="endog">: for a system of simultaneous equations, a list of endogenous variables. This is primarily intended for use with FIML estimation, but with Three-Stage Least Squares this approach may be used instead of giving an <@lit="instr"> list; then all the variables not identified as endogenous will be used as instruments. 
</indent>

<indent>
• <@lit="identity">: for use with FIML, an identity linking two or more of the variables in the system. This sort of statement is ignored when an estimator other than FIML is used. 
</indent>

After estimation using the <@lit="system"> or <@lit="estimate"> commands the following accessors can be used to retrieve additional information: 

<indent>
• <@lit="$uhat">: the matrix of residuals, one column per equation. 
</indent>

<indent>
• <@lit="$yhat">: matrix of fitted values, one column per equation. 
</indent>

<indent>
• <@lit="$coeff">: column vector of coefficients (all the coefficients from the first equation, followed by those from the second equation, and so on). 
</indent>

<indent>
• <@lit="$vcv">: covariance matrix of the coefficients. If there are <@mth="k"> elements in the <@lit="$coeff"> vector, this matrix is <@mth="k"> by <@mth="k">. 
</indent>

<indent>
• <@lit="$sigma">: cross-equation residual covariance matrix. 
</indent>

<indent>
• <@lit="$sysGamma">, <@lit="$sysA"> and <@lit="$sysB">: structural-form coefficient matrices (see below). 
</indent>

If you want to retrieve the residuals or fitted values for a specific equation as a data series, select a column from the <@lit="$uhat"> or <@lit="$yhat"> matrix and assign it to a series, as in 

<code>          
   series uh1 = $uhat[,1]
</code>

The structural-form matrices correspond to the following representation of a simultaneous equations model: 

  <@fig="structural">

If there are <@mth="n"> endogenous variables and <@mth="k"> exogenous variables, Γ is an <@itl="n">×<@itl="n"> matrix and <@mth="B"> is <@itl="n">×<@itl="k">. If the system contains no lags of the endogenous variables then the <@mth="A"> matrix is not present. If the maximum lag of an endogenous regressor is <@mth="p">, the <@mth="A"> matrix is <@itl="n">×<@itl="np">. 

Menu path: /Model/Simultaneous equations

# tabprint Printing

Options: 	<@lit="--rtf"> (Produce RTF instead of LaTeX)
		<@lit="--csv"> (Produce CSV instead of LaTeX)
		<@lit="--complete"> (Create a complete document)
		<@lit="--format="f1|f2|f3|f4""> (Specify a custom format)
		<@lit="--output">=<@var="filename"> (send output to specified file)

Must follow the estimation of a model. Prints the estimated model in tabular form — by default as LaTeX, but as RTF if the <@opt="--⁠rtf"> flag is given or as CSV is the <@opt="--⁠csv"> flag is given. If a filename is specified using the <@opt="--⁠output"> option output goes to that file, otherwise it goes to a file with a name of the form <@lit="model_N"> followed by the extension <@lit="tex">, <@lit="rtf"> or <@lit="csv">, where <@lit="N"> is the number of models estimated to date in the current session. 

If CSV format is selected, values are comma-separated unless the decimal comma is in force, in which case the separator is the semicolon. Note that CSV output may be less complete than the other formats. 

The further options discussed below are available only when printing the model as LaTeX. 

If the <@opt="--⁠complete"> flag is given the LaTeX file is a complete document, ready for processing; otherwise it must be included in a document. 

If you wish alter the appearance of the tabular output, you can specify a custom row format using the <@opt="--⁠format"> flag. The format string must be enclosed in double quotes and must be tied to the flag with an equals sign. The pattern for the format string is as follows. There are four fields, representing the coefficient, standard error, <@mth="t">-ratio and p-value respectively. These fields should be separated by vertical bars; they may contain a <@lit="printf">-type specification for the formatting of the numeric value in question, or may be left blank to suppress the printing of that column (subject to the constraint that you can't leave all the columns blank). Here are a few examples: 

<code>          
   --format="%.4f|%.4f|%.4f|%.4f"
   --format="%.4f|%.4f|%.3f|"
   --format="%.5f|%.4f||%.4f"
   --format="%.8g|%.8g||%.4f"
</code>

The first of these specifications prints the values in all columns using 4 decimal places. The second suppresses the p-value and prints the <@mth="t">-ratio to 3 places. The third omits the <@mth="t">-ratio. The last one again omits the <@mth="t">, and prints both coefficient and standard error to 8 significant figures. 

Once you set a custom format in this way, it is remembered and used for the duration of the gretl session. To revert to the default format you can use the special variant <@opt="--⁠format=default">. 

Menu path: Model window, /LaTeX

# textplot Graphs

Argument: 	<@var="varlist"> 
Options: 	<@lit="--time-series"> (plot by observation)
		<@lit="--one-scale"> (force a single scale)
		<@lit="--tall"> (use 40 rows)

Quick and simple ASCII graphics. Without the <@opt="--⁠time-series"> flag, <@var="varlist"> must contain at least two series, the last of which is taken as the variable for the <@mth="x"> axis, and a scatter plot is produced. In this case the <@opt="--⁠tall"> option may be used to produce a graph in which the <@mth="y"> axis is represented by 40 rows of characters (the default is 20 rows). 

With the <@opt="--⁠time-series">, a plot by observation is produced. In this case the option <@opt="--⁠one-scale"> may be used to force the use of a single scale; otherwise if <@var="varlist"> contains more than one series the data may be scaled. Each line represents an observation, with the data values plotted horizontally. 

See also <@ref="gnuplot">. 

# tobit Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--llimit">=<@var="lval"> (specify left bound)
		<@lit="--rlimit">=<@var="rval"> (specify right bound)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (see <@ref="logit"> for explanation)
		<@lit="--verbose"> (print details of iterations)

Estimates a Tobit model, which may be appropriate when the dependent variable is "censored". For example, positive and zero values of purchases of durable goods on the part of individual households are observed, and no negative values, yet decisions on such purchases may be thought of as outcomes of an underlying, unobserved disposition to purchase that may be negative in some cases. 

By default it is assumed that the dependent variable is censored at zero on the left and is uncensored on the right. However you can use the options <@opt="--⁠llimit"> and <@opt="--⁠rlimit"> to specify a different pattern of censoring. Note that if you specify a right bound only, the assumption is then that the dependent variable is uncensored on the left. 

The Tobit model is a special case of interval regression, which is supported via the <@ref="intreg"> command. 

Menu path: /Model/Limited dependent variable/Tobit

# tsls Estimation

Arguments: 	<@var="depvar"> <@var="indepvars"> ; <@var="instruments"> 
Options: 	<@lit="--no-tests"> (don't do diagnostic tests)
		<@lit="--vcv"> (print covariance matrix)
		<@lit="--robust"> (robust standard errors)
		<@lit="--cluster">=<@var="clustvar"> (clustered standard errors)
		<@lit="--liml"> (use Limited Information Maximum Likelihood)
		<@lit="--gmm"> (use the Generalized Method of Moments)
Example: 	<@lit="tsls y1 0 y2 y3 x1 x2 ; 0 x1 x2 x3 x4 x5 x6">

Computes Instrumental Variables (IV) estimates, by default using two-stage least squares (TSLS) but see below for further options. The dependent variable is <@var="depvar">, <@var="indepvars"> is the list of regressors (which is presumed to include at least one endogenous variable); and <@var="instruments"> is the list of instruments (exogenous and/or predetermined variables). If the <@var="instruments"> list is not at least as long as <@var="indepvars">, the model is not identified. 

In the above example, the <@lit="y">s are endogenous and the <@lit="x">s are the exogenous variables. Note that exogenous regressors should appear in both lists. 

Output for two-stage least squares estimates includes the Hausman test and, if the model is over-identified, the Sargan over-identification test. In the Hausman test, the null hypothesis is that OLS estimates are consistent, or in other words estimation by means of instrumental variables is not really required. A model of this sort is over-identified if there are more instruments than are strictly required. The Sargan test is based on an auxiliary regression of the residuals from the two-stage least squares model on the full list of instruments. The null hypothesis is that all the instruments are valid, and suspicion is thrown on this hypothesis if the auxiliary regression has a significant degree of explanatory power. For a good explanation of both tests see chapter 8 of <@bib="Davidson and MacKinnon (2004);davidson-mackinnon04">. 

For both TSLS and LIML estimation, an additional test result is shown provided that the model is estimated under the assumption of i.i.d. errors (that is, the <@opt="--⁠robust"> option is not selected). This is a test for weakness of the instruments. Weak instruments can lead to serious problems in IV regression: biased estimates and/or incorrect size of hypothesis tests based on the covariance matrix, with rejection rates well in excess of the nominal significance level <@bib="(Stock, Wright and Yogo, 2002);stock-wright-yogo02">. The test statistic is the first-stage <@mth="F">-test if the model contains just one endogenous regressor, otherwise it is the smallest eigenvalue of the matrix counterpart of the first stage <@mth="F">. Critical values based on the Monte Carlo analysis of <@bib="Stock and Yogo (2003);stock-yogo03"> are shown when available. 

The R-squared value printed for models estimated via two-stage least squares is the square of the correlation between the dependent variable and the fitted values. 

For details on the effects of the <@opt="--⁠robust"> and <@opt="--⁠cluster"> options, please see the help for <@ref="ols">. 

As alternatives to TSLS, the model may be estimated via Limited Information Maximum Likelihood (the <@opt="--⁠liml"> option) or via the Generalized Method of Moments (<@opt="--⁠gmm"> option). Note that if the model is just identified these methods should produce the same results as TSLS, but if it is over-identified the results will differ in general. 

If GMM estimation is selected, the following additional options become available: 

<indent>
• <@opt="--⁠two-step">: perform two-step GMM rather than the default of one-step. 
</indent>

<indent>
• <@opt="--⁠iterate">: Iterate GMM to convergence. 
</indent>

<indent>
• <@opt="--⁠weights="><@var="Wmat">: specify a square matrix of weights to be used when computing the GMM criterion function. The dimension of this matrix must equal the number of instruments. The default is an appropriately sized identity matrix. 
</indent>

Menu path: /Model/Instrumental variables

# var Estimation

Arguments: 	<@var="order"> <@var="ylist"> [ ; <@var="xlist"> ] 
Options: 	<@lit="--nc"> (do not include a constant)
		<@lit="--trend"> (include a linear trend)
		<@lit="--seasonals"> (include seasonal dummy variables)
		<@lit="--robust"> (robust standard errors)
		<@lit="--robust-hac"> (HAC standard errors)
		<@lit="--quiet"> (skip output of individual equations)
		<@lit="--silent"> (don't print anything)
		<@lit="--impulse-responses"> (print impulse responses)
		<@lit="--variance-decomp"> (print variance decompositions)
		<@lit="--lagselect"> (show criteria for lag selection)
Examples: 	<@lit="var 4 x1 x2 x3 ; time mydum">
		<@lit="var 4 x1 x2 x3 --seasonals">
		<@lit="var 12 x1 x2 x3 --lagselect">

Sets up and estimates (using OLS) a vector autoregression (VAR). The first argument specifies the lag order — or the maximum lag order in case the <@opt="--⁠lagselect"> option is given (see below). The order may be given numerically, or as the name of a pre-existing scalar variable. Then follows the setup for the first equation. Do not include lags among the elements of <@var="ylist"> — they will be added automatically. The semi-colon separates the stochastic variables, for which <@var="order"> lags will be included, from any exogenous variables in <@var="xlist">. Note that a constant is included automatically unless you give the <@opt="--⁠nc"> flag, a trend can be added with the <@opt="--⁠trend"> flag, and seasonal dummy variables may be added using the <@opt="--⁠seasonals"> flag. 

While a VAR specification usually includes all lags from 1 to a given maximum, it is possible to select a specific set of lags. To do this, substitute for the regular (scalar) <@var="order"> argument either the name of a predefined vector or a comma-separated list of lags, enclosed in braces. We show below two ways of specifying that a VAR should include lags 1, 2 and 4 (but not lag 3): 

<code>          
   var {1,2,4} ylist
   matrix p = {1,2,4}
   var p ylist
</code>

A separate regression is reported for each variable in <@var="ylist">. Output for each equation includes <@mth="F">-tests for zero restrictions on all lags of each of the variables, an <@mth="F">-test for the significance of the maximum lag, and, if the <@opt="--⁠impulse-responses"> flag is given, forecast variance decompositions and impulse responses. 

Forecast variance decompositions and impulse responses are based on the Cholesky decomposition of the contemporaneous covariance matrix, and in this context the order in which the (stochastic) variables are given matters. The first variable in the list is assumed to be "most exogenous" within-period. The horizon for variance decompositions and impulse responses can be set using the <@ref="set"> command. For retrieval of a specified impulse response function in matrix form, see the <@xrf="irf"> function. 

If the <@opt="--⁠robust"> option is given, standard errors are corrected for heteroskedasticity. Alternatively, the <@opt="--⁠robust-hac"> option can be given to produce standard errors that are robust with respect to both heteroskedasticity and autocorrelation (HAC). In general the latter correction should not be needed if the VAR includes sufficient lags. 

If the <@opt="--⁠lagselect"> option is given, the first parameter to the <@lit="var"> command is taken as the maximum lag order. Output consists of a table showing the values of the Akaike (AIC), Schwarz (BIC) and Hannan–Quinn (HQC) information criteria computed from VARs of order 1 to the given maximum. This is intended to help with the selection of the optimal lag order. The usual VAR output is not presented. The table of information criteria may be retrieved as a matrix via the <@lit="$test"> accessor. 

Menu path: /Model/Time series/Vector autoregression

# varlist Dataset

Options: 	<@lit="--scalars"> (list scalars)
		<@lit="--accessors"> (list accessor variables)

By default, prints a listing of the (series) variables currently available; <@lit="ls"> may be used as an alias for this command. 

If the <@opt="--⁠scalars"> option is given, prints a listing of any currently defined scalar variables and their values. Otherwise, if the <@opt="--⁠accessors"> option is given, prints a list of the internal variables currently available via accessors such as <@xrf="$nobs"> and <@xrf="$uhat">. 

# vartest Tests

Arguments: 	<@var="series1"> <@var="series2"> 

Calculates the <@mth="F"> statistic for the null hypothesis that the population variances for the variables <@var="series1"> and <@var="series2"> are equal, and shows its p-value. 

Menu path: /Tools/Test statistic calculator

# vecm Estimation

Arguments: 	<@var="order"> <@var="rank"> <@var="ylist"> [ ; <@var="xlist"> ] [ ; <@var="rxlist"> ] 
Options: 	<@lit="--nc"> (no constant)
		<@lit="--rc"> (restricted constant)
		<@lit="--uc"> (unrestricted constant)
		<@lit="--crt"> (constant and restricted trend)
		<@lit="--ct"> (constant and unrestricted trend)
		<@lit="--seasonals"> (include centered seasonal dummies)
		<@lit="--quiet"> (skip output of individual equations)
		<@lit="--silent"> (don't print anything)
		<@lit="--impulse-responses"> (print impulse responses)
		<@lit="--variance-decomp"> (print variance decompositions)
Examples: 	<@lit="vecm 4 1 Y1 Y2 Y3">
		<@lit="vecm 3 2 Y1 Y2 Y3 --rc">
		<@lit="vecm 3 2 Y1 Y2 Y3 ; X1 --rc">
		See also <@inp="denmark.inp">, <@inp="hamilton.inp">

A VECM is a form of vector autoregression or VAR (see <@ref="var">), applicable where the variables in the model are individually integrated of order 1 (that is, are random walks, with or without drift), but exhibit cointegration. This command is closely related to the Johansen test for cointegration (see <@ref="coint2">). 

The <@var="order"> parameter to this command represents the lag order of the VAR system. The number of lags in the VECM itself (where the dependent variable is given as a first difference) is one less than <@var="order">. 

The <@var="rank"> parameter represents the cointegration rank, or in other words the number of cointegrating vectors. This must be greater than zero and less than or equal to (generally, less than) the number of endogenous variables given in <@var="ylist">. 

<@var="ylist"> supplies the list of endogenous variables, in levels. The inclusion of deterministic terms in the model is controlled by the option flags. The default if no option is specified is to include an "unrestricted constant", which allows for the presence of a non-zero intercept in the cointegrating relations as well as a trend in the levels of the endogenous variables. In the literature stemming from the work of Johansen (see for example his 1995 book) this is often referred to as "case 3". The first four options given above, which are mutually exclusive, produce cases 1, 2, 4 and 5 respectively. The meaning of these cases and the criteria for selecting a case are explained in <@pdf="the Gretl User's Guide">. 

The optional lists <@var="xlist"> and <@var="rxlist"> allow you to specify sets of exogenous variables which enter the model either unrestrictedly (<@var="xlist">) or restricted to the cointegration space (<@var="rxlist">). These lists are separated from <@var="ylist"> and from each other by semicolons. 

The <@opt="--⁠seasonals"> option, which may be combined with any of the other options, specifies the inclusion of a set of centered seasonal dummy variables. This option is available only for quarterly or monthly data. 

The first example above specifies a VECM with lag order 4 and a single cointegrating vector. The endogenous variables are <@lit="Y1">, <@lit="Y2"> and <@lit="Y3">. The second example uses the same variables but specifies a lag order of 3 and two cointegrating vectors; it also specifies a "restricted constant", which is appropriate if the cointegrating vectors may have a non-zero intercept but the <@lit="Y"> variables have no trend. 

Following estimation of a VECM some special accessors are available: <@lit="$jalpha">, <@lit="$jbeta"> and <@lit="$jvbeta"> retrieve, respectively, the α and β matrices and the estimated variance of β. For retrieval of a specified impulse response function in matrix form, see the <@xrf="irf"> function. 

Menu path: /Model/Time series/VECM

# vif Tests

Must follow the estimation of a model which includes at least two independent variables. Calculates and displays the Variance Inflation Factors (VIFs) for the regressors. The VIF for regressor <@mth="j"> is defined as 

  <@fig="vif">

where <@mth="R"><@sub="j"> is the coefficient of multiple correlation between regressor <@mth="j"> and the other regressors. The factor has a minimum value of 1.0 when the variable in question is orthogonal to the other independent variables. <@bib="Neter, Wasserman, and Kutner (1990);neter-etal90"> suggest inspecting the largest VIF as a diagnostic for collinearity; a value greater than 10 is sometimes taken as indicating a problematic degree of collinearity. 

Menu path: Model window, /Tests/Collinearity

# wls Estimation

Arguments: 	<@var="wtvar"> <@var="depvar"> <@var="indepvars"> 
Options: 	<@lit="--vcv"> (print covariance matrix)
		<@lit="--robust"> (robust standard errors)
		<@lit="--quiet"> (suppress printing of results)

Computes weighted least squares (WLS) estimates using <@var="wtvar"> as the weight, <@var="depvar"> as the dependent variable, and <@var="indepvars"> as the list of independent variables. Let <@var="w"> denote the positive square root of <@lit="wtvar">; then WLS is basically equivalent to an OLS regression of <@var="w"> <@lit="*"> <@var="depvar"> on <@var="w"> <@lit="*"> <@var="indepvars">. The <@itl="R">-squared, however, is calculated in a special manner, namely as 

  <@fig="wlsr2">

where ESS is the error sum of squares (sum of squared residuals) from the weighted regression and WTSS denotes the "weighted total sum of squares", which equals the sum of squared residuals from a regression of the weighted dependent variable on the weighted constant alone. 

If <@var="wtvar"> is a dummy variable, WLS estimation is equivalent to eliminating all observations with value zero for <@var="wtvar">. 

Menu path: /Model/Other linear models/Weighted Least Squares

# xcorrgm Statistics

Arguments: 	<@var="series1"> <@var="series2"> [ <@var="order"> ] 
Option: 	<@lit="--plot">=<@var="mode-or-filename"> (see below)
Example: 	<@lit="xcorrgm x y 12">

Prints and graphs the cross-correlogram for <@var="series1"> and <@var="series2">, which may be specified by name or number. The values are the sample correlation coefficients between the current value of <@var="series1"> and successive leads and lags of <@var="series2">. 

If an <@var="order"> value is specified the length of the cross-correlogram is limited to at most that number of leads and lags, otherwise the length is determined automatically, as a function of the frequency of the data and the number of observations. 

By default, a plot of the cross-correlogram is produced: a gnuplot graph in interactive mode or an ASCII graphic in batch mode. This can be adjusted via the <@opt="--⁠plot"> option. The acceptable parameters to this option are <@lit="none"> (to suppress the plot); <@lit="ascii"> (to produce a text graphic even when in interactive mode); <@lit="display"> (to produce a gnuplot graph even when in batch mode); or a file name. The effect of providing a file name is as described for the <@opt="--⁠output"> option of the <@ref="gnuplot"> command. 

Menu path: /View/Cross-correlogram
Other access: Main window pop-up menu (multiple selection)

# xtab Statistics

Arguments: 	<@var="ylist"> [ ; <@var="xlist"> ] 
Options: 	<@lit="--row"> (display row percentages)
		<@lit="--column"> (display column percentages)
		<@lit="--zeros"> (display zero entries)
		<@lit="--matrix">=<@var="matname"> (use frequencies from named matrix)

Displays a contingency table or cross-tabulation for each combination of the variables included in <@var="ylist">; if a second list <@var="xlist"> is given, each variable in <@var="ylist"> is cross-tabulated by row against each variable in <@var="xlist"> (by column). Variables in these lists can be referenced by name or by number. Note that all the variables must have been marked as discrete. Alternatively, if the <@opt="--⁠matrix"> option is given, treat the named matrix as a precomputed set of frequencies and display this as a cross-tabulation. 

By default the cell entries are given as frequency counts. The <@opt="--⁠row"> and <@opt="--⁠column"> options (which are mutually exclusive), replace the counts with the percentages for each row or column, respectively. By default, cells with a zero count are left blank; the <@opt="--⁠zeros"> option, which has the effect of showing zero counts explicitly, may be useful for importing the table into another program, such as a spreadsheet. 

Pearson's chi-square test for independence is displayed if the expected frequency under independence is at least 1.0e-7 for all cells. A common rule of thumb for the validity of this statistic is that at least 80 percent of cells should have expected frequencies of 5 or greater; if this criterion is not met a warning is printed. 

If the contingency table is 2 by 2, Fisher's Exact Test for independence is computed. Note that this test is based on the assumption that the row and column totals are fixed, which may or may not be appropriate depending on how the data were generated. The left p-value should be used when the alternative to independence is negative association (values tend to cluster in the lower left and upper right cells); the right p-value should be used if the alternative is positive association. The two-tailed p-value for this test is calculated by method (b) in section 2.1 of <@bib="Agresti (1992);agresti92">: it is the sum of the probabilities of all possible tables having the given row and column totals and having a probability less than or equal to that of the observed table.