```1. Introduction. . . . . . . . . . . . . . . . . . . . . . . .1

2. Getting Started . . . . . . . . . . . . . . . . . . . . . .3
2.1. Tools you will need to use TSP . . . . . . . . . . . .3
2.1.1. On a personal computer  . . . . . . . . . . . .3
2.1.2. On a shared or network computer . . . . . . . .3
2.2. A little vocabulary. . . . . . . . . . . . . . . . . .3
2.3. A simple regression example. . . . . . . . . . . . . .4

3. TSP Fundamentals. . . . . . . . . . . . . . . . . . . . . .7
3.1. Describing the sample of observations:  FREQ, SMPL . .7
3.2. Reading data into TSP:  READ . . . . . . . . . . . . .8
3.2.1. Reading data in free format within the program.8
3.2.2. Reading data from an external file. . . . . . .9
3.3. Selection of observation subsets:  SELECT, SMPLIF. . .9
3.4. Missing Values . . . . . . . . . . . . . . . . . . . 10
3.5. Creating new series with transformations:  GENR. . . 10
3.5.1. Dummy variables and recoding. . . . . . . . . 11
3.5.2. Lags and leads. . . . . . . . . . . . . . . . 11
3.5.3. Dynamic GENR. . . . . . . . . . . . . . . . . 12
3.6. Useful statements at the beginning of a TSP job. . . 13
3.7. The order of statements in a TSP job . . . . . . . . 13
3.8. The next step. . . . . . . . . . . . . . . . . . . . 14
3.9. An extended example. . . . . . . . . . . . . . . . . 14

4. Interacting with TSP. . . . . . . . . . . . . . . . . . . 20
4.1. Basic operation. . . . . . . . . . . . . . . . . . . 20
4.1.1. Beginning and ending a session. . . . . . . . 20
4.1.2. Modes of operation. . . . . . . . . . . . . . 21
4.1.3. Entering commands in Interactive Mode . . . . 21
4.2. Requesting information:  HELP, REVIEW, FIND, SHOW. . 22
4.3. Methods of entering or reading data. . . . . . . . . 22
4.4. Saving selected output during interactive use: . . . 23
4.5 Sample session in Interactive Mode. . . . . . . . . . 24

5. Estimation of Linear Equations. . . . . . . . . . . . . . 28
5.1. Descriptive Statistics:  MSD, CORR . . . . . . . . . 28
5.2. Ordinary least squares: OLSQ . . . . . . . . . . . . 29
5.3. Regression output. . . . . . . . . . . . . . . . . . 30
5.4. Two-stage least squares:  2SLS, INST . . . . . . . . 31
5.5. Limited information maximum likelihood:  LIML. . . . 33
5.6. First-order serial correlation:  AR1 . . . . . . . . 33
5.6.1. Instrumental variable estimation in AR1 . . . 35
5.7. Distributed lags . . . . . . . . . . . . . . . . . . 35
5.7.1. Polynomial distributed lags . . . . . . . . . 36
5.7.2. What PDL does . . . . . . . . . . . . . . . . 36
5.7.3. Shiller lags. . . . . . . . . . . . . . . . . 38
5.8. Weighted regression: the WEIGHT option . . . . . . . 38
5.8.1. Normalization of weights. . . . . . . . . . . 40
5.8.2. Weighted descriptive statistics . . . . . . . 40
5.9. Robust standard errors in the regression procedures. 40
5.10. Least absolute deviations regressions (LAD) . . . . 41

6. Manipulation and Display of TSP Variables . . . . . . . . 42
6.1. Using the results of one procedure in another:  COPY 43
6.2. Printing series and other variables:  PRINT, WRITE . 43
6.3. Graphic displays of data . . . . . . . . . . . . . . 44
6.3.1. Plotting time series:  PLOT, PLOTS, NOPLOT . . . . 44
6.3.2. Graphs or scatter plots:  GRAPH . . . . . . . 45
6.3.3. Plotting histograms:  HIST. . . . . . . . . . 45
6.4. Sorting data:  SORT. . . . . . . . . . . . . . . . . 47
6.5. Dummy and trend variables:  DUMMY, TREND . . . . . . 48
6.6. Computation of Capital Stock:  CAPITL. . . . . . . . 48
6.7. Divisia Indices:  DIVIND . . . . . . . . . . . . . . 49
6.8. Normalization of Series:  NORMAL . . . . . . . . . . 50
6.9. Seasonal Adjustment:  SAMA . . . . . . . . . . . . . 50
6.10. Principal Components:  PRIN . . . . . . . . . . . . 51

7. Estimation of Nonlinear Systems of Equations. . . . . . . 52
7.1. Specifying the model:  FRML, FORM, IDENT, PARAM. . . 52
7.2. Nonlinear least squares:  LSQ. . . . . . . . . . . . 54
7.2.1. Single equation least squares . . . . . . . . 54
7.2.2. Multivariate regression and SUR . . . . . . . 55
7.2.3. Nonlinear two-stage least squares:  INST= . . 55
7.2.4. Linear/NL three-stage least squares:  3SLS. . 56
7.2.5. Generalized Method of Moments . . . . . . . . 56
7.3. Full information maximum likelihood:  FIML . . . . . 60

8. Testing Hypotheses. . . . . . . . . . . . . . . . . . . . 62
8.1. t-tests. . . . . . . . . . . . . . . . . . . . . . . 62
8.2. F-tests. . . . . . . . . . . . . . . . . . . . . . . 63
8.3. Chow tests . . . . . . . . . . . . . . . . . . . . . 64
8.4. Pseudo-F tests for 2SLS. . . . . . . . . . . . . . . 64
8.5. Likelihood ratio tests . . . . . . . . . . . . . . . 65
8.6. Nonlinear 2SLS and 3SLS -- the QLR test. . . . . . . 65
8.7. Wald tests -- linear/NL restrictions:  ANALYZ. . . . 66
8.8. Lagrange Multiplier Tests (Score Tests). . . . . . . 67
8.9. Hausman Specification Tests. . . . . . . . . . . . . 69

9. Qualitative Dependent Variables and General ML Estimation 70
9.1. TOBIT. . . . . . . . . . . . . . . . . . . . . . . . 70
9.2. PROBIT . . . . . . . . . . . . . . . . . . . . . . . 71
9.3. Sample Selection:  SAMPSEL . . . . . . . . . . . . . 72
9.4. Multinomial and conditional logit:  LOGIT. . . . . . 73
9.5. General Maximum Likelihood Estimation:  ML, EQSUB. . 74
9.5.1 ML PROC. . . . . . . . . . . . . . . . . . . . 75
9.6. ML examples. . . . . . . . . . . . . . . . . . . . . 75
9.6.1. OLS . . . . . . . . . . . . . . . . . . . . . 75
9.6.2. Box-Cox Transformation. . . . . . . . . . . . 76
9.6.3. ARCH(3) model . . . . . . . . . . . . . . . . 76
9.6.4. Frontier production model . . . . . . . . . . 77
9.6.5. Basic Tobit Model . . . . . . . . . . . . . . 77
9.6.6. Tobit reparametrized for global concavity . . 77
9.6.7. Multinomial Logit . . . . . . . . . . . . . . 77
9.6.8. Sample Selection. . . . . . . . . . . . . . . 78
9.6.9. Ordered Probit. . . . . . . . . . . . . . . . 78
9.6.10. Nested Logit . . . . . . . . . . . . . . . . 79
9.6.11. Switching regression . . . . . . . . . . . . 81
9.6.12. Poisson and negative binomial models . . . . 81
9.6.13. Bivariate probit model . . . . . . . . . . . 81
9.6.14. Hazard function. . . . . . . . . . . . . . . 83

10. Nonlinear Minimization Methods and Convergence Options . 84
10.1. Nonlinear minimization methods for estimation . . . 84
10.2. General convergence hints . . . . . . . . . . . . . 84
10.3. Diagnostic printing:  PRINT, VERBOSE, SILENT. . . . 85
10.4. Numerical error handling. . . . . . . . . . . . . . 85
10.5. Hessian and gradient methods:  HITER, HCOV. . . . . 86
10.6. Squeezing:  STEP, MAXSQZ. . . . . . . . . . . . . . 86
10.7. Overall options:  MAXIT, TOL. . . . . . . . . . . . 87

11. Estimation Using Time Series Data. . . . . . . . . . . . 88
11.1. Techniques for time series data . . . . . . . . . . 88
11.1.1. Changing the frequency of a series:  CONVERT 88
11.2. Box-Jenkins (ARIMA) models. . . . . . . . . . . . . 89
11.2.1. Identification:  BJIDENT . . . . . . . . . . 89
11.2.2. Estimation:  BJEST . . . . . . . . . . . . . 90
11.2.3. Forecasting:  BJFRCST. . . . . . . . . . . . 90
11.3. Auto-Regressive Conditional Heteroskedasticity. . . 91
11.4. The Kalman Filter (KALMAN). . . . . . . . . . . . . 97
11.5. Vector Autoregressions (VAR). . . . . . . . . . . . 99
11.6. Testing for Unit Roots and Cointegration:  COINT . . .100

12. Controlling the Execution of a TSP Program . . . . . . .103
12.1. Loops:  DO. . . . . . . . . . . . . . . . . . . . .103
12.2. Loops over Names:  DOT. . . . . . . . . . . . . . .104
12.3. User Procedures:  PROC. . . . . . . . . . . . . . .105
12.4. Statement Label and Go To Statement:  GOTO. . . . .106
12.5. Conditional Statements:  IF, THEN, ELSE . . . . . .106
12.6. Controlling Printed Output:  REGOPT . . . . . . . .107

13. Matrix Computations. . . . . . . . . . . . . . . . . . .108
13.1. Matrix formats. . . . . . . . . . . . . . . . . . .108
13.2. Creating a matrix . . . . . . . . . . . . . . . . .109
13.2.1. Reading matrices:  READ. . . . . . . . . . .109
13.2.2. Matrix results from TSP procedures:  COPY. .110
13.2.3. Making a matrix from series/scalars:  MMAKE.111
13.2.4. Making a matrix from other matrices:  MFORM.112
13.3. Matrix algebra: MAT . . . . . . . . . . . . . . . .113
13.3.1. MAT command and matrix operations. . . . . .113
13.3.2. Matrix functions with scalar output. . . . .114
13.3.3. Matrix functions with matrix output. . . . .114
13.3.4. Matrix procedures:  ORTHON, YLDFAC . . . . .115
13.4. Examples using matrix operations. . . . . . . . . .116
13.4.1. A Hausman specification test . . . . . . . .116
13.4.2. Prediction error for linear regression . . .116
13.4.3. Ridge regression . . . . . . . . . . . . . .117

14. Forecasting and Model Simulation . . . . . . . . . . . .118
14.1. Creating equations:  FRML, FORM . . . . . . . . . .118
14.2. Forecasting with an explicit equation:  GENR. . . .119
14.3. Forecasting linear models:  FORCST. . . . . . . . .119
14.4. Solving simultaneous equation models. . . . . . . .120
14.4.1. Small nonlinear models:  SIML. . . . . . . .121
14.4.1.1. Newton's Method . . . . . . . . . . .121
14.4.2. Large models . . . . . . . . . . . . . . . .122
14.4.2.1. Ordering equations:  MODEL. . . . . .122
14.4.2.2. Solution:  SOLVE. . . . . . . . . . .123
14.4.2.3. Gauss-Seidel and Jacobi methods . . .123
14.4.2.4. Fletcher-Powell method. . . . . . . .123
14.4.2.5. Example:  a 33-equation model . . . .123
14.5. Displaying and evaluating a forecast:  ACTFIT . . .124
14.6. Monte Carlo Simulation:  RANDOM . . . . . . . . . .129

15. Panel Data . . . . . . . . . . . . . . . . . . . . . . .131
15.1. The basics of using panel data. . . . . . . . . . .131
15.1.1. Reading in panel data. . . . . . . . . . . .131
15.1.2. Unbalanced panels. . . . . . . . . . . . . .132
15.2. Random and Fixed Effects models -- PANEL. . . . . .133
15.3. Robust estimation with panel data . . . . . . . . .134
15.3.1. The PI matrix method . . . . . . . . . . . .135
15.3.2. Dynamic factor models with panel data. . . .137
15.3.3. GMM Estimation of panel data models. . . . .137

16. Storing Data on External Files . . . . . . . . . . . . .139
16.1. Using external sequential files:  READ, WRITE . . .139
16.1.1. Data organization on external files. . . . .140
16.1.2. Closing external files:  CLOSE . . . . . . .140
16.2. Spreadsheet files . . . . . . . . . . . . . . . . .141
16.2.1. Reading spreadsheet files. . . . . . . . . .142
16.2.1.1. READ examples for spreadsheet files .143
16.2.2. Writing spreadsheet files. . . . . . . . . .143
16.2.2.1. WRITE examples for spreadsheet files.143
16.3. TSP Databanks . . . . . . . . . . . . . . . . . . .144
16.3.1. Storing variables in a databank:  OUT. . . .144
16.3.2. Documenting variables on a databank:  DOC. .145
16.3.3. Retrieving variables from a databank:  IN. .145
16.3.4. Databank utilities:  DBLIST, DBPRINT, DBCOPY146
16.3.5. Using older databanks in TSP 4.4 . . . . . .146
16.3.6. Using micro-TSP/EViews databanks:  FETCH . .146
16.4. Saving a work session in a file:  SAVE, RESTORE . .147

17. Time Savers in Interactive TSP . . . . . . . . . . . . .148
17.1. Revision and re-execution of commands . . . . . . .148
17.1.1. Re-execution . . . . . . . . . . . . . . . .148
17.1.2. Modifying commands and fixing typos. . . . .148
17.1.3. Adding and dropping variables. . . . . . . .149
17.2. Reading commands from disk. . . . . . . . . . . . .150
17.2.1. Your TSP login file. . . . . . . . . . . . .150
17.3. Talking to the operating system . . . . . . . . . .151
17.4. Automatic backup and recovery . . . . . . . . . . .151

Appendices

A. Basic Rules of TSP. . . . . . . . . . . . . . . . . . . .152

B. Command Syntax Summary. . . . . . . . . . . . . . . . . .156

C. Differences Between TSP 4.4 and Earlier Versions. . . . .169
C.1. General changes released in 4.4 only . . . . . . . .169
C.2. General changes released in some copies of 4.3 . . .170
C.3. Command-specific improvements released in 4.4 only .170
C.4. Command-specific improvements released in 4.3. . . .172
C.5. Non-upward compatibilities . . . . . . . . . . . . .173

D. Using TSP on a DOS/Win Personal Computer. . . . . . . . .175
D.1. Running TSP under Windows. . . . . . . . . . . . . .175
D.2. Running TSP under DOS. . . . . . . . . . . . . . . .175
D.3. Graphics in TSP: PLOT, GRAPH . . . . . . . . . . . .175
D.3.1. Choice of GRAPHICS cards for TSP. . . . . . .175
D.3.2. Converting graphics files for WordPerfect . .176

E. Using TSP on the Apple Macintosh. . . . . . . . . . . . .177
E.1. Running TSP in Interactive mode. . . . . . . . . . .177
E.2. Running TSP in Batch Mode. . . . . . . . . . . . . .178
E.3. File formats and Names . . . . . . . . . . . . . . .178
E.4. Graphics in Mac TSP: PLOT, GRAPH . . . . . . . . . .178

F. Using TSP on a Unix Computer. . . . . . . . . . . . . . .179

References . . . . . . . . . . . . . . . . . . . . . . . . .181

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . .189
```