Latest TSP Examples
Last updated: Mar-19-07
Examples Sorted by Date
By Date
Examples Sorted by Group
The examples below are the latest bits of code that have
arisen from technical support questions, plus a few which
were volunteered by TSP users.
A few of them are relatively rough and may not be fully
commented. Others are extensively commented, and some are
in PROC form, quite ready for general use.
Some of the examples are cross-referenced in a second
category. The first category will then be given in
parentheses. For example, panunit is listed first
under U (Unit root), and second under Panel.
Example Categories
- Panel data Models
- QDV Models
- Time Series
- General Nonlinear Estimation
- General
G - Panel - GMM models
- usbalme
  2002-11-12,1993-03 uses: gmmchisq rdusbal
Panel GMM with measurement errors
- arelbon2
  2002-02-20
Arellano-Bond example with 3 RHS variables.
- gapubal
  2000-05-04
Setting up a gapped SMPL for unbalanced stacked panel data, so that GMM(NMA=k) can be used.
- probitac (F)
  1998-05-05
Probit with SEs robust to autocorrelation (PROBIT,GMM).
- arelbond
  1998-04-17,1997-09 uses: cov1step premaskg
Simple Arellano-Bond example, 1-step and 2-step estimators (balanced panel data). Uses very simple artificial data.
- cov1step
  1997-12-17,1997-08 (proc)
Arellano-Bond 1-step COVOC matrix - GMM/panel
- firstdif
  1997-11-11
Automates creation of first-differenced variables for GMM panel models, where the variables are named by time period, like y1 y2 y3, etc. (DOT)
- lm2test
  1997-10-08,1997-03 (proc)
like Arellano-Bond m2 statistic, tests AR(1) and AR(2), by Bronwyn Hall.
- lm2test2
  1997-10-08 (proc)
Alternative version of lm2test, using explicit lags. Unfortunately, it seems to be about 20% slower than lm2test.
- cov2step
  1997-09-18 (proc)
Arellano-Bond 2-step COVOC matrix - GMM/panel
- premaskg
  1997-08-04 (proc)
creates mask for GMM with panel data
- premaskc
  1997-08-04 uses: premaskg
2 examples of calling premaskg
- mask2
  1996-02-27
2 different ways to set up a large sparse MASK matrix for use in GMM (different instruments in different equations).
E - Panel - Error Components models
- kleinfe (P)
  2001-01-26
2SLS and 3SLS with (one-way) fixed effects. Shows the easy way to do this - by removing the individual means from all variables (including the instruments). Results match those with individual dummies. Uses the Klein data, as a 3-individual unbalanced panel. Outdated in TSP 5.0 by 2SLS(FEI), 3SLS(FEI).
- reub
  2001-01-17 (proc)
Random Effects on UnBalanced data - ML estimation of one-way model. Written as a PROC, where you just supply a list of RHS variables. Outdated in TSP 5.0 by PANEL(REI).
- reubab
  2001-01-17 uses: reub
example of using the REUB Proc, on the Arellano-Bond model.
- probitre
  1999-11-12
Probit with Random Effects - the Borjas-Sueyoshi 2-stage model. Monte Carlo analysis. Comments on the Pooled vs. Random Effects estimators. Related to PROBIT(REI) in TSP 5.0.
- g4
  1999-11-02
Panel 1-way and 2-way variance components (both individual and time effects), via Maximum Likelihood (vs. GLS). For balanced data. A better version is on the Benchmarks page. Outdated in TSP 5.0 by PANEL(REI,REIT).
- ec3sls
  1999-02-04
3SLS with 2-way error components, balanced panel. Uses transformed data with 3SLS commands. Much faster than old matrix versions.
- ec2sls
  1999-02-04
2SLS with 2-way error components, balanced panel. Uses transformed data with 2SLS commands. Much faster than old matrix versions.
- ec3sm1
  1999-02-04,1997-11
3SLS with 2-way error components, balanced panel, Old matrix version.
- ec2sm3
  1999-02-04,1997-11
2SLS with 2-way error components, balanced panel, 3rd Matrix version.
- p3s
  1997-11-26
Example of using ec3sm1 on a real model (data files are not included).
- ec2sm1
  1997-11-18,1997-09
First matrix algebra version of ec2sls. Does not use transformed data. Notation differs a bit from Hsiao(1986).
- ec2sm2
  1997-11-18
Second matrix algebra version of ec2sls. Uses transformed data; notation is close to Hsiao(1986).
- h3b
  1997-09-11
Hsiao(1986)'s Appendix 3B - verifies 2-way EC Omega inverse (MATRIX)
- apd
  1997-05-20
creates artificial panel data. balanced, one-way random effects, 2 Xs correlated with random effects (RANDOM)
- ub2wfere
  1996-12-18
unbalanced 2-way fixed and random effects follows Wansbeek and Kapteyn (J of E, 7/1989). Not tested against any real-world benchmark results. See also g4, which can be extended to the unbalanced case. GLS estimation, which depends on the method chosen to estimate the variance components. Compare with PANEL(REIT) in TSP 5.0 which uses ML estimation.
- data2way
  1996-12-18
generates artificial data for 2-way model (RANDOM)
P - Panel - other than GMM and Error Components
- gcoefi
  2006-04-13
Panel OLS model where some coefficients vary by individual, and others do not. Includes a PROC to automate this.
- pstr
  2005-09-14
Panel Smooth Transition Regression. 2 regimes. grid search and ML PROC estimation
- frontp2 (Q)
  2005-07-28,2001-01
Frontier production function, unbalanced panel or cross section, v_it - u_it. Truncation point depends on z*d function. Follows Battese and Coelli, 1995. Simpler than frontp1.
- pansd
  2004-10-06
computes standard deviation of a panel series within each individual, and stores result as a series
- gspd5
  2003-06-23,1994-01
Duplicate state variables for each industry.
- pdlpanel
  2003-06-23,1994-09
PDL done via the PANEL command. (OLSQ,PANEL,ANALYZ)
- feihat
  2002-09-18
hat matrix (leverage) for fixed effects model.
- panrw
  2001-04-10
simulates Panel Random Walk with drift. (RANDOM)
- koyck2 (D)
  2001-02-02
koyckp example applied to a different dataset. (LSQ,EQSUB)
- fixedse
  2001-02-01,1996-11
standard errors for the intercept terms in a fixed effects model (balanced or unbalanced). Outdated by PANEL(FEPRINT) in TSP 5.0.
- kleinfe
  2001-01-26
2SLS and 3SLS with (one-way) fixed effects. Shows the easy way to do this - by removing the individual means from all variables (including the instruments). Results match those with individual dummies. Uses the Klein data, as a 3-individual unbalanced panel. Outdated in TSP 5.0 by 2SLS(FEI), 3SLS(FEI).
- frontp1 (Q)
  2001-01-25
Frontier production function, unbalanced panel, error components, v_it - u_i. Follows Battese and Coelli, 1992. See frontp2 for a simpler version. (ML)
- koyckp (D)
  2001-01-24
Koyck (geometric) distributed lag, with truncation terms for finite sample panel or time series. Example on Almon data. (LSQ,EQSUB)
- timediff
  2000-11-21
time dummies in first differenced equations (when differencing to remove individual effects)
- probitfe
  2000-07-12
Probit fixed effects - efficient iteration for large N. Outdated by PROBIT(FEI) in TSP 5.0.
- diaghet
  2000-06-23
Diagonal heteroskedasticity model (like SUR, but no off-diagonal terms); can be useful when N > T.
- panw
  2000-06-16
Weighted fixed effects estimation.
- panmeans
  2000-02-07,1998-08
Removing individual or time means.
- pansmpl
  1999-10-22 (proc)
For Panel data with FREQ Q or M. Proc FIRMDATE creates @FIRM (1,2,...,N) and @DATE (197801,197802,...,199712) variables. These can be used to SELECT particular firms and ranges of dates for regressions. For balanced data which does not already have ID and Date variables.
- balu
  1999-09-07
Panel - "balances" unbalanced data by adding artificial observations with zeros for all variables.
- sbicpan
  1999-08-15
SBIC values for Total and Within in PANEL. Also explains why SBIC may not be easy to use for choosing an optimal number of lags. Outdated by PANEL in TSP 5.0.
- ah
  1999-08-12
Anderson-Hsiao 2SLS for dynamic panel model (avoids finite sample bias in fixed effects estimator).
- fixedubmv
  1999-07-15, 1998-06
How to convert PANEL's @FIXED matrix to a series, for the most general case, when the data is unbalanced and has missing values. Outdated by PANEL, which stores the series @AI in TSP 5.0.
- panchow
  1999-06-09,1998-03
Chow test for panel data, within model, where both the coefficients and fixed effects vary across 2 periods.
- panunit (U)
  1999-05-11,1997-08
Panel unit root test of Im, Pesaran, and Shin. Improved version, which has the URL for downloading the paper, and describes how to look up the critical values in IPS Tables 2-4.
- ar1fmlp (T)
  1999-03-01
AR(1) (exact ML) for panel data, using the FIML command. Reproduces AR1(TSCS) results. Should be revised to use NODROPMISS option.
- panboot
  1999-02-09
Panel bootstrapping. Draws residuals within an individual.
- fixediv
  1998-05-16,1997-05
2SLS with fixed effects. Efficient computation, by using PANEL in 2 stages. See kleinfe for an improved method. Outdated by 2SLS(FEI) in TSP 5.0.
- ar1hetub
  1998-04-29 (proc)
version of ar1het for unbalanced data (Kmenta's GLS model using transformed data)
- logitshp (L)
  1998-02-06
Mixed Logit on (24) shares (fractional dependent variables aggregated over many choosers), panel data. Calculates predicted shares. Handles missing X values for zero shares (in a rather ad hoc way). (ML)
- unbalsu4 (M)
  1997-11-26
(ML) SUR with 4 equations, in a nested pattern of missing data. In this example, there are 4 drugs that were invented at different times, and then observed up to the present (artificial data are used). The code can be used for 1-4 equations in this type of pattern.
- ar1het
  1997-11-21
AR(1) model with heteroskedasticity (rho(i), sigma2(i)). This follows Kmenta's "Elements of Econometrics" (1986) p.618-620. Includes a helpful degrees of freedom adjustment. This model has been criticized because rho(i) may proxy for individual effects alpha(i) that are not included.
- logitfe3 (L)
  1997-06-20
fixed effects logit for panel data with 3 time periods (choice taken 1 or 2 times). Follows Hsiao(1986), p.162. (ML)
- garcia
  1997-06-12
Growth model, stochastic differential equations, unbalanced panel. Uses recursive EQSUB. This nonlinear panel growth model is used on tree heights. (ML)
- panhaus (B)
  1997-02-13 data: PATDATA.DAT
reproduces Hausman test of RE vs. FE in panel data (ANALYZ,MATRIX)
- bal2wfe
  1996-12-18
balanced 2-way fixed effects
- coxpanel
  1996-05-16
ML estimation of Cox proportional hazards model, balanced data example with 3 time periods. Uses lagged EQSUB feature.
L - Logit models
- dpdx3
  2002-04-10,1999-03
Mean and variance of dP/dX for Logit with 3 choices.
- logitbc
  2002-12-14
Logit with approximate Bias Correction.
- pr2 (F)
  2002-11-13,1996-12
McFadden's pseudo R-squared for Probit/Logit. In TSP 4.4 as "Kullback-Leibler R-squared" (@KLRSQ). Outdated by LOGIT in TSP 4.5, which stores Estrella's "Scaled R-squared".
- mnestlog2
  2001-08-27
2-level nested multinomial logit.
- nestlog2
  2001-08-27
2-level nested conditional logit.
- nestl
  2001-04-20
nested logit example from TSP User's Guide. Shows relation to mixed logit model.
- logitlim
  1999-09-07
Same as logitcsu, but includes code which takes limits of ratios, to avoid EXP(xb) overflow, when xb is larger than 88.
- logitcsu
  1999-09-07 uses: balu
Logit - conditional, with shares as dependent variable, unbalanced data. Data has been "balanced" by running balu first.
- rpl
  1999-08-03
Random Parameters (coefficients) Logit. Example with a fixed intercept and one additional RHS variable with a normally distributed random coefficient. (ML PROC)
- logitsh
  1998-02-25,1996-07
Logit with shares as dependent variables. Was previously corrupted on examples disk and web page. (ML)
- logitshp
  1998-02-06
Mixed Logit on (24) shares (fractional dependent variables aggregated over many choosers), panel data. Calculates predicted shares. Handles missing X values for zero shares (in a rather ad hoc way). (ML)
- logitfe3
  1997-06-20
fixed effects logit for panel data with 3 time periods (choice taken 1 or 2 times). Follows Hsiao(1986), p.162. (ML)
- testnlog
  1997-04-01
2 level (5 x 10) nested logit, with artificial test data, by Bronwyn Hall
- wclogit
  1996-10-31,1994-03
weighted conditional logit. (ML)
- logitmix
  1996-09-25
mixed logit via ML command; a standard TSP testrun
- logiteach
  1996-09-12
data setup code for conditional logit, where each alternative is chosen exactly once.
- logitf
  1996-05-20 (proc)
forecasts from a multinomial logit model (picks most likely Y value for a set of X values). not tested. (LIST, DOT)
- nest31
  1994-12-06
improved version of NEST3, can be changed for diff. model, by Paul Ruud (ML)
- nest3
  1994-11-30
3-level nested logit (see nest31 for improved version) (ML)
- dpdx
  1994-06-02
standard errors for @DPDX from Logit. ANALYZ can also do this.
- nlogit
  1993-11-05
2-level nested logit (ML)
F - Probit models
- opdydx
  2005-02-03
dy/dx for Ordered Probit. Computes change in histogram of predicted dependent variable, for changes in a given X variable.
- msprobit (S)
  2004-03-29
Real Markov switching Probit model, by Masahito Kobayashi. (ML PROC)
- ebiprob
  2003-11-19
Bivariate probit where Y2 is not observed unless Y1=1. (ML)
- probks2
  2002-04-12
Semiparametric Probit (Klein and Spady) on large dataset (2339 obs.). Should revise to use KERNEL command in TSP 5.0. Matrix version.
- probks
  2002-04-12
Semiparametric Probit (Klein and Spady) on small dataset (32 obs.). DO loop version.
- pr2
  2002-11-13,1996-12
McFadden's pseudo R-squared for Probit/Logit. In TSP 4.4 as "Kullback-Leibler R-squared" (@KLRSQ). Outdated by LOGIT in TSP 4.5, which stores Estrella's "Scaled R-squared".
- tobithet (J)
  2001-08-27
Tobit and Probit, when heteroskedasticity is a function of variables. (ML)
- op3
  2001-08-09 (proc)
Ordered Probit - examines changes in Y for changes in a dummy variable. Example with 3 choices. (ORDPROB)
- opfp
  2001-06-28 (proc) data: counta.zip
Ordered Probit forecasted probabilities. (ORDPROB)
- phe
  2001-04-09
Bivariate Probit with Hermite quadrature. Compared with random effects Probit model, and regular CNORM2() version.
- hetprob
  2001-01-26,1995-10
LM test for heteroskedasticity in Probit. Follows Godfrey's book.
- op1r1 (Q)
  2001-01-12
2 eqns: Ordered Probit (3 choices) and Regression / sample selection (ML)
- p1op1
  2001-01-11
2 eqns: Probit and Ordered Probit, correlated, by Bronwyn Hall (ML)
- p1r2n (Q)
  2000-12-16
3 eqns: Probit and 2 Regression - non-selection, with simultaneity in Probit eqn (ML)
- p1r2s (Q)
  2000-12-16
3 eqns: Probit and 2 Regression - selection model (ML)
- biprob
  2000-11-30,199-03 (proc)
Bivariate probit, in ML using CNORM2(z1,z2,rho). Written as a Proc; should be easy to use on real data -- just supply the variable names. (ML)
- probitfe (P)
  2000-07-12
Probit fixed effects - efficient iteration for large N. Outdated by PROBIT(FEI) in TSP 5.0.
- probitre (E)
  1999-11-12
Probit with Random Effects - the Borjas-Sueyoshi 2-stage model. Monte Carlo analysis. Comments on the Pooled vs. Random Effects estimators. Related to PROBIT(REI) in TSP 5.0.
- probder
  1999-10-06
Probability derivatives in Probit. Gives an alternative method of assessing changes in Y, for changes to a 0/1 RHS variable. (Derivatives are not appropriate for large changes in a discrete variable).
- swprob
  1999-06-11
Switching Probits model, regime unknown. Estimated by ML with new CNORM2(z1,z2,rho) function. Follows Kimhi(1999). Like Maddala(1983), p.223, except the equations which switch are probits instead of regressions. (ML)
- tnp
  1999-03-01 (proc)
Trinomial probit, in ML using the new CNORM2(z1,z1,rho) function in TSP 4.5. Uses one possible normalization for the residual correlation matrix, but it is not clear which normalization is best for an unrestricted model. See also the bunch example, which shows that the probability derivatives are invariant to different parameterizations the residual covariance matrix.
- probitac
  1998-05-05
Probit with SEs robust to autocorrelation (PROBIT,GMM).
J - Tobit models
- tob2
  2007-03-07,1992-11-06
2-equation (bivariate) simultaneous Tobit
- hurdle2
  2006-11-17
Double Hurdle model. Tobit is single hurdle; this is like Tobit with an additional selection equation.
- tobr2
  2002-06-19
R-squared for Tobit model, one possible formulation. (TOBIT)
- tobpred
  2002-05-22
Predictions from Tobit model, conditional and unconditional. (TOBIT,GENR)
- tobithet
  2001-08-27
Tobit and Probit, when heteroskedasticity is a function of variables. (ML)
- scls
  2000-03-28,1999-04 (proc)
Symmetrically Censored Least Squares - proposed by Powell (1986) for Tobit model estimator robust to non-normality. The Newton algorithm here improves its iteration performance greatly. Includes test dataset. by Joao Santos Silva, of UTL/ISEG, Lisbon.
- tob2lim
  1998-07-24,1997-10 (proc)
2-Limit Tobit (with both upper and lower bounds). Uses globally concave parameterization for iterations, to avoid convergence problems. Written as a Proc -- you supply variable names and upper/lower bounds. Outdated by TOBIT(LOWER=,UPPER=) in TSP 5.0. (ML)
- tobrncf
  1997-04-02
Tobit with random coefficients, Ionnatos, JBES July 1995 (ML)
- tobendog
  1996-02-13
ML estimation of a 2-equation model, where one equation is a tobit (truncated at zero), and the second equation has this variable on the RHS.
- tob2sur
  1992-11-06
2-equation Tobit, but with no RHS endogenous variables
S - Switching regression models
- msprobit
  2004-03-29
Real Markov switching Probit model, by Masahito Kobayashi. (ML PROC)
- regime
  2004-03-29
Real Markov switching regression model, by Masahito Kobayashi. (ML PROC)
- swregun
  2003-11-19
Switching with unknown regime and unknown sample separation, by Augustin de Coulon. (ML)
- hamsimp
  2000-09-11
Markov chain model - simple 2-regime from Hamilton's book, via EM. By David Bivin
- markovrt (T)
  1999-11-09
Simple switching regression models - one with regime known, one with regime unknown. Not really Markov Chain models, because the switching does not involve the probability of the states in the previous period (for regime unknown). Data is generated from a Markov Chain, though. (ML)
- swprob (F)
  1999-06-11
Switching Probits model, regime unknown. Estimated by ML with new CNORM2(z1,z2,rho) function. Follows Kimhi(1999). Like Maddala(1983), p.223, except the equations which switch are probits instead of regressions. (ML)
- swreg
  1999-06-11
Switching regression, regime unknown. Follows Maddala(1983), p.283. (ML)
- diseq104
  1997-09-16
Disequilibrium model, with sample separation known. Section 10.4 of Maddala(1983), p.307-309. (LSQ)
- switch
  1996-11-11
Disequilibrium / switching regression model from 4.3 User's Guide, by Bronwyn Hall. Maddala p.298 (ML)
Q - QDV - Qualitative Dependent Variables (other than above)
- frontp2
  2005-07-28,2001-01
Frontier production function, unbalanced panel or cross section, v_it - u_it. Truncation point depends on z*d function. Follows Battese and Coelli, 1995. Simpler than frontp1.
- fronte
  2004-04-13,2002-03
Efficiency term for Frontier model from Battesse and Coelli (1988). Extends example in TSP User's Guide. (ML)
- frontp1
  2001-01-25
Frontier production function, unbalanced panel, error components, v_it - u_i. Follows Battese and Coelli, 1992. See frontp2 for a simpler version. (ML)
- op1r1
  2001-01-12
2 eqns: Ordered Probit (3 choices) and Regression / sample selection (ML)
- p1op1 (F)
  2001-01-11
2 eqns: Probit and Ordered Probit, correlated, by Bronwyn Hall (ML)
- p1r2n
  2000-12-16
3 eqns: Probit and 2 Regression - non-selection, with simultaneity in Probit eqn (ML)
- p1r2s
  2000-12-16
3 eqns: Probit and 2 Regression - selection model (ML)
- biprob (F)
  2000-11-30,199-03 (proc)
Bivariate probit, in ML using CNORM2(z1,z2,rho). Written as a Proc; should be easy to use on real data -- just supply the variable names. (ML)
- opac
  2000-08-17 data: counta.zip
Ordered Probit with AutoCorrelation-robust SEs (ORDPROB,DIFFER,GMM)
- count
  1999-10-26
14 alternative Count (Poisson and Negative Binomial) models, including Hurdle and Zero-Inflated models. Automated via ML command. Written by Vincenzo Atella, with help from Clint Cummins. (ML)
- ssg1g
  1999-03-23
sample selection model - demonstrates multiple local optima with grid search, following Nawata(1995). Graphs LogL vs. RHO. Outdated by SAMPSEL with automated grid search in TSP 4.5. (SAMPSEL,ML)
- nbsim
  1998-06-11
Using RANDOM(NEGBIN) when the mean is different for each observation. Outdated by RANDOM(NEGBIN,MEAN=series) in TSP 5.0.
- coxpanel (P)
  1996-05-16
ML estimation of Cox proportional hazards model, balanced data example with 3 time periods. Uses lagged EQSUB feature.
- bivord
  1994-11-16
Bivariate Ordered Probit (without data). Could be improved in TSP 4.5 and higher by using CNORM(z1,z2,rho) function.
- cn4
  1993-08-24
4-dimensional cumulative normal integral, approximated with many random draws, CNORM(), CNORMI(), and Cholesky factorization.
- bivar
  1993-04-01
approximation for Bivariate normal CDF in ML. Outdated by CNORM(z1,z2,rho) in TSP 4.5.
- hazard
  1993-01-01
log-linear hazard function with one time-varying covariate
- samsel2
  1992-12-03
sample selection with 2 selection equations (undocumented)
H - GARCH models
- archdiag
  2002-10-28 (proc)
Diagnostic tests for asymmetry of ARCH residuals.
- igarch
  1999-11-16
Integrated GARCH(1,1), with constraint that alpha1+beta1=1.
- archf
  1999-09-30
ARCH forecasting for H_t. Revised slightly for TSP 4.5, where ARCH no longer estimates H(0) by default.
- egarch11
  1999-02-23
EGARCH(1,1) estimation. Exponential GARCH, where log(h(t)) = alpha0 + alpha1*abs(e(t-1)) + beta1*log(h(t-1)).
K - Kalman filter
- kald
  1998-09-11
Kalman filter with dummy variables that are singular in the initial observations (used to test new recursive residuals that no longer assume initial observations are nonsingular).
- kalmanhp
  1998-04-13,1997-01
Kalman filter HyperParameter estimation, using ML PROC. Estimates 2 variance parameters in the transition equation.
- kfllt
  1996-09-05
Kalman Filter on Local Linear Trend - Harvey(1989), p.170
- kfarma11
  1996-07-22
Evaluation of conditional likelihood function for ARMA(1,1) via the KALMAN command.
- kfma1
  1996-07-18
Ditto, but for MA(1) model. Harvey, TSM, 1981, p.103
- kfloop2
  1996-06-21
Kalman filter in a DO loop, to compute SEs for state vector at each period. 2 parameters in state vector, with prior computed from initial observations.
- kfloop
  1996-06-21
Kalman filter in a DO loop, to compute SEs for state vector at each period. 1 parameter in state vector, with user-supplied prior.
- kfml
  1996-03-07
estimates Kalman Filter transition matrix via grid search (2 parameters). Compare with kalmanhp above.
U - Unit root and cointegration
- vratio2
  2002-07-09 (proc)
Revised code for vratio, with changed commands noted by question marks. The changes need to be checked against the original reference, and then merged with the main vratio example.
- adfbrk
  2002-04-05,2002-02 (proc)
ADF tests with trend breakpoints.
- adfgls
  2000-04-28,1997-05
GLS version of ADF unit root test with p-value (Elliott, Rothenberg, Stock (1992,1996)), by Yin-Wong Cheung.
- vratio
  2000-03-24,1998-07 (proc)
Variance ratio test for unit root. See vratio2 also.
- cointarp
  2000-01-05
Cointegration test with AR(p) residuals - Stock-Watson(1993) and Phillips-Loretan(1991, p.424).
- joh1
  1999-09-30,1994
Reproduces Johansen-Juselius cointegration results for Finnish data. Originally by David Cushman. (VAR,MATRIX)
- gmmns
  1999-05-27
GMM on non-stationary data. Follows Hamilton(1994), p.424 / Ogaki(1993). Estimates model as a function of detrended variables.
- panunit
  1999-05-11,1997-08
Panel unit root test of Im, Pesaran, and Shin. Improved version, which has the URL for downloading the paper, and describes how to look up the critical values in IPS Tables 2-4.
- shinfull
  1998-10-02 (proc)
Shin-Fuller ARMA(p+1,q) unit root test from Journal of Time Series Analysis 1998. Uses exact ML ARMA estimation with multiplicative seasonal. Computes P-value of test statistic by interpolating critical value table from paper. (BJEST)
- sft
  1998-10-02 uses: shinfull
Tests shinfull on artificial data. Test P-values against published table of critical values. (RANDOM)
- ppmex
  1996-10-24 uses: ppzt
Phillips-Perron "z hat sub t" unit root test on Mexican data.
- ppenders
  1996-10-24 uses: ppzt
ppzt on data from 4 countries. Mostly reproduces table on p.263 of Enders, "Applied Economic Time Series", 1995
- ppzt
  1996-10-24 (proc)
Phillips-Perron "z hat sub t" version of the Dickey-Fuller unit root test. Differs from "z hat sub alpha" test in the COINT(PP) command.
- kwunit2
  1996-03-29 (proc)
KPSS unit root test. Revised version of KWUNIT Proc by Phil Meguire. Handles any frequency, adds argument to control taking log of input series, and includes critical values from the paper. Compare with Clint's revised version (kwunit) below. Shows different styles of coding.
- kwunit
  1996-01-08 (proc)
KPSS unit root test, where stationarity is the null. Revised version - handles data of any frequency - uses current SMPL to determine range of data
V - VAR - Vector AutoRegression
- vardif
  2004-10-19
VAR on differenced series, but compute impulse response for original series
- gir2
  2002-03-07
Generalized Impulse Response, via LSQ and SOLVE. (extendable to structural VAR)
- varira
  2002-02-15
Impulse Response SEs via ANALYZ. Hardcoded example for 3 equations, 4 lags, 6 periods.
- gir
  2001-03-20
Generalized Impulse Response - invariant to equation order. Reproduces results in Pesaran and Shin (1998) with KPSW data. (VAR,GRAPH)
- varmc
  2000-11-07,1998-09
VAR with Monte Carlo. Runs VAR in a loop with bootstrapped residuals to compute empirical distributions of any item in VAR's output. This example computes standard errors for variance decompositions.
- bernanke
  1999-08-14,1998-10 (proc)
VAR: Bernanke-Sims decomposition. This is a way of factoring Sigma, where the user specifies zero restrictions on particular elements of the factorization. Based on RATS code, and includes test examples.
- varst32
  1998-11-13,1995-11
Uses BJEST to check polynomial roots for stationarity of a VAR (3 variables, 2 lags). See varst21 for simpler version.
- varbq
  1998-10-26 (proc)
VAR Blanchard-Quah decomposition (AER 1989). This is an alternative way of factoring Sigma (vs. the arbitrary Cholesky shocks) for impulse responses. The user orders the equations so that the first variable can have a long-run effect on all variables, and the last variable can have a long-run effect only on itself. Includes an example with 2 variables and 4 lags.
- varsiml
  1998-06-11,1994-08
Use SIML to create impulse responses, after a VAR command.
- varforc
  1998-06-11,1997-05
Static forecast after VAR. Outdated by FORCST in TSP 4.5.
- sbic
  1998-02-19
Shows 3 different normalizations for SBIC and AIC, and which one TSP 4.4 uses in OLSQ. In TSP 4.5, we switched to using the unnormalized SBIC and AIC.
- varsbici
  1997-09-25
Chooses optimal lag orders for VAR by minimizing @SBIC. Allows for different lags on different variables. Example with just 2 variables.
- varsbic
  1997-09-11
chooses optimal lag order for VAR by minimizing @SBIC
- varst21
  1995-11-13
same as varst32, but 2 variables with 1 lag (much easier to read and understand)
D - Distributed Lags (including PDL)
- pdlpanel (P)
  2003-06-23,1994-09
PDL done via the PANEL command. (OLSQ,PANEL,ANALYZ)
- lnormdl
  2002-04-05
Distributed lag with shape from lognormal density. (LSQ,GRAPH)
- gammadl
  2002-04-05
Distributed lag with shape from gamma density. (LSQ,GRAPH)
- koyck2
  2001-02-02
koyckp example applied to a different dataset. (LSQ,EQSUB)
- koyckp
  2001-01-24
Koyck (geometric) distributed lag, with truncation terms for finite sample panel or time series. Example on Almon data. (LSQ,EQSUB)
- pdlar
  1997-07-11 (proc)
single PDL variable with AR(p) residuals (FORM,EQSUB,LSQ,ANALYZ)
- pdlar2
  1997-06-13 uses: pdlar
example of calling pdlar
- pdlar243
  1997-06-12 uses: pdlar43
example of using pdlar43 (calls pdlar43)
- pdlar43
  1997-06-12
older version of pdlar, using TSP 4.3 commands
T - Time series (miscellaneous)
- regma1
  2007-03-19 (proc)
Regression with MA(1) residuals.
- regarma2
  2007-02-23,1999-01-08
regression with ARMA(8,2) errors, exact ML. See also regarma for conditional ML (but more complicated). (ML PROC,BJEST)
- arma41ml
  2004-12-03
regression with ARMA(4,1) residual. exact ML. Sunspot data.
- ar1mlp
  2004-12-03
regression with AR(1) residual. Reproduces AR1 command with ML PROC and new BJEST option.
- ar2mlp (B)
  2004-11-28
regression with AR(2) residual, exact ML estimation. Uses both ML and ML PROC, with the new BJEST option which allows general ARMA residuals. Klein-I consumption function data.
- plotac
  2004-09-16,1996-09 (proc)
Proc which can be called after BJIDENT to print the autocorrelation function (and its 95% bounds) with color graphics. (BJIDENT,GRAPH)
- dl
  2004-04-20
Approximation to dL (lower critical value for Durbin-Waston, using NOB and K1.
- regarma
  2003-05-14,1997-10
Regression with ARMA(8,2) errors (uses ML PROC). Conditional ML. Easier to modify than previous codes like armax7. See regarma2 for exact ML, which is easier to use.
- bkf
  2002-10-26,2001-05 (proc)
Baxter-King filter.
- dwnl
  2002-06-12
Approximate P-value for Durbin-Watson in nonlinear model, using regression on first derivatives. (LSQ,DIFFER,REGOPT)
- bilin2
  2001-09-25
second order bilinear model, by Wiedyo Pura Buana
- star (A)
  2001-05-25
Smooth Transition AutoRegressive models. (FORM,EQSUB,LSQ)
- dateloop (I)
  2000-11-21
looping over a dated sample - simpler than doquart example, and explains 2 methods (DO,SELECT,SMPL)
- calendar
  2000-02-28,1998-07 (proc)
Calendar information in Procs. Use to convert packed dates like 981231 to year,month,day variables; find which weekday, week, and month a particular day of the year is, etc.
- markovrt
  1999-11-09
Simple switching regression models - one with regime known, one with regime unknown. Not really Markov Chain models, because the switching does not involve the probability of the states in the previous period (for regime unknown). Data is generated from a Markov Chain, though. (ML)
- changept
  1999-09-27
Andrews (1993) test for structural change with unknown change point (Maximum Wald test). Includes a Monte Carlo loop to verify that distribution of the test matches his results.
- ar1fmlp
  1999-03-01
AR(1) (exact ML) for panel data, using the FIML command. Reproduces AR1(TSCS) results. Should be revised to use NODROPMISS option.
- expsm2
  1999-01-06
Double exponential smoothing with arbitrary smoothing parameter. Compares with ARIMA(0,2,2) model. (MODEL,SOLVE,BJEST)
- hptrend44
  1997-10-21 (proc)
Faster version of HPtrend (Hodrick-Prescott trend decomposition). Uses the MFORM(BAND) option in TSP 4.4 for maximum speed. Also includes modular versions of the Proc for fast use with multiple series. (MFORM,MATRIX)
- qtomw
  1997-06-20 (proc)
Quarterly to Monthly conversion, using ratio to average, and weights (sum and average versions).
- qtomw2
  1997-06-20 uses: qtomw
Examples of calling qtomw, converting forecasts from quarterly model into monthly forecasts.
- ma
  1997-02-25 (proc)
simple Proc to calculate moving average of length n
- gapbal
  1997-02-21
creates gapped smpl for balanced AR1(TSCS). Outdated by FREQ(PANEL) in TSP 4.4.
- dh (B)
  1997-02-11
reproduces Durbin's h statistic
- bilinear
  1996-01-30
ML estimation of simple bilinear time series model. Uses recursive derivative code; could be made simpler with ML PROC.
- ar1tscs
  1995-06-21
easy way of creating the gapped SMPL for AR1(TSCS), from an ID variable, for balanced or unbalanced data. Outdated by FREQ(PANEL) in TSP 4.4.
- doquart (I)
  1994-05-12
DO loop over time periods with quarterly data. Example with rolling regression and one-period-ahead forecasts. See the dateloop example for a simpler loop.
M - ML and ML PROC, and general nonlinear estimation
- regarma2 (T)
  2007-02-23,1999-01-08
regression with ARMA(8,2) errors, exact ML. See also regarma for conditional ML (but more complicated). (ML PROC,BJEST)
- pstr (P)
  2005-09-14
Panel Smooth Transition Regression. 2 regimes. grid search and ML PROC estimation
- gammas
  2004-10-29
gamma simulation of rainfall model, where trace values below 0.1 are truncated to zero.
- gammar
  2004-10-29
gamma estimation of rainfall model. Uses ML PROC and CDF to evaluate igamma() function.
- boxcoxj
  2004-03-17
Jacobian term for testing log vs. level and general Box-Cox model. (FIML)
- hhsim
  2003-06-25
Minimum distance estimation of Hall-Hayashi dynamic factor model. Uses simulated data, a runnable version of the hhex example. by Bronwyn Hall (EQSUB,SUR)
- regarma (T)
  2003-05-14,1997-10
Regression with ARMA(8,2) errors (uses ML PROC). Conditional ML. Easier to modify than previous codes like armax7. See regarma2 for exact ML, which is easier to use.
- aids
  2002-06-13
Almost Ideal Demand System, with elasticities, Deaton and Muellbauer model, based on SAS example. (LSQ,EQSUB,ANALYZ)
- spatial
  2001-04-04,1997-12 (proc)
Proc which estimates Spatial Autocorrelation and Spatial Autoregressive models. User supplies W = spatial proximity weight matrix. (ML PROC,MATRIX)
- biquad
  2000-01-03
Bivariate normal cdf - how to evaluate probabilities in all 4 quadrants, by changing signs of the arguments to CNORM2(z1,z2,rho).
- boxtid0
  1999-10-06
Box-Tidwell regression when the RHS variables are sometimes zero. (LSQ)
- rpl (L)
  1999-08-03
Random Parameters (coefficients) Logit. Example with a fixed intercept and one additional RHS variable with a normally distributed random coefficient. (ML PROC)
- expsm2 (T)
  1999-01-06
Double exponential smoothing with arbitrary smoothing parameter. Compares with ARIMA(0,2,2) model. (MODEL,SOLVE,BJEST)
- ar1fml (A)
  1998-11-03
AR(1) exact ML with the FIML and ML commands. Should be revised to use NODROPMISS option.
- boxcoxar
  1998-07-28
Box-Cox with AR(1) residual. Should be revised to use NODROPMISS option. (FIML)
- boxcox0
  1998-05-29
Box-Cox transformation when Y is zero
- student (R)
  1998-05-26
regression with Student t residuals; see also stacklos example.
- kalmanhp (K)
  1998-04-13,1997-01
Kalman filter HyperParameter estimation, using ML PROC. Estimates 2 variance parameters in the transition equation.
- rancoef
  1998-03-11
ML estimation of a regression with a single random coefficient. Outlines how to extend to multiple random coefficients.
- spatcal
  1997-12-05 uses: spatial
Example of running spatial.tsp on California plant species data. Reproduces results for Spatial AutoCorrelation and Spatial AutoRegression from Upton and Fingleton (1985).
- olsme
  1997-12-04
OLS with measurement errors on the dependent variable, and known variances for these measurement errors (obtained from a first stage estimation). That is, the composite variance is made from these known variances that differ across observations, plus a residual variance that is equal across observations.
- unbalsu4
  1997-11-26
(ML) SUR with 4 equations, in a nested pattern of missing data. In this example, there are 4 drugs that were invented at different times, and then observed up to the present (artificial data are used). The code can be used for 1-4 equations in this type of pattern.
- stacklos (R)
  1997-09-12
LAD and Student's t residuals on classic Stack Loss dataset (LAD,ML)
- fiml5
  1997-07-21
FIML via ML with 5 equations (like fiml4 and fiml11)
- garcia (P)
  1997-06-12
Growth model, stochastic differential equations, unbalanced panel. Uses recursive EQSUB. This nonlinear panel growth model is used on tree heights. (ML)
- ml2stage
  1997-04-22
calculates corrected VCOV for second stage ML estimator. Automated differentiation. Useful in 2-stage estimation, where the second stage uses data computed from first stage ML parameter estimates. No example model or data. (ML,DIFFER,MATRIX)
- unbalsu1
  1996-12-02
unbalanced SUR -- 2 equations; some observations missing for the second equation. ML version only (easiest way to get estimates and proper standard errors). (ML)
- grid
  1996-05-23
checks a 3-parameter nonlinear model for multiple local optima. 2 different ways of choosing starting values: 1. full grid 2. random draw within bounds (like simulated anealling) reports back optimum found (DO,RANDOM)
- kfml (K)
  1996-03-07
estimates Kalman Filter transition matrix via grid search (2 parameters). Compare with kalmanhp above.
- bilinear (T)
  1996-01-30
ML estimation of simple bilinear time series model. Uses recursive derivative code; could be made simpler with ML PROC.
- fiml11
  1995-12-22
11-equation FIML estimation, via the ML command. Just an extension of the old fiml4 example. (ML)
- unbalml
  1995-12-15
slightly more complicated version of unbalsu1. Probably not needed.
- unbalsur
  1995-08-10
does unbalanced SUR estimation (2 equations) in about 4 different ways. Fairly complicated. Users who don't want to compare minimum distance, pairwise deletion, etc. should just use unbalsu1. (LSQ,ML)
- fiml4
  1993-12-01
4-equation FIML with ML command (HCOV=N, LDL' example). Example of how to parametrize the multivariate normal density, using LDL' factorization of Sigma-inverse. Part of the original motivation for this was to have HITER=N and HCOV=N for a FIML model. In TSP 5.0, FIML(HITER=C,HCOV=C) is a convenient and accurate approximation to HITER=N,HCOV=N.
A - Autoregressive residuals with LSQ (nonlinear/multiequation)
- surar1
  2004-05-27,1997-04
nonlinear SUR with AR(1) residuals, different RHO for each equation, conditional or exact ML (LSQ,FIML)
- formar1
  2002-11-29
FRML with exact ML first observation for LSQ; includes Jacobian trick so that FIML is not needed.
- ar1w
  2001-06-22
weighted AR1 estimation via ML in TSP 4.5
- ar1fse
  2001-06-12
AR1 forecast standard errors, via ANALYZ.
- star
  2001-05-25
Smooth Transition AutoRegressive models. (FORM,EQSUB,LSQ)
- ar1fml
  1998-11-03
AR(1) exact ML with the FIML and ML commands. Should be revised to use NODROPMISS option.
- boxcoxar (M)
  1998-07-28
Box-Cox with AR(1) residual. Should be revised to use NODROPMISS option. (FIML)
- pdlar (D)
  1997-07-11 (proc)
single PDL variable with AR(p) residuals (FORM,EQSUB,LSQ,ANALYZ)
- pdlar2 (D)
  1997-06-13 uses: pdlar
example of calling pdlar
- pdlar243 (D)
  1997-06-12 uses: pdlar43
example of using pdlar43 (calls pdlar43)
- pdlar43 (D)
  1997-06-12
older version of pdlar, using TSP 4.3 commands
- ar4nl
  1997-02-05
AR(4) on single nonlinear equation (conditional ML) (EQSUB,LSQ)
R - Robust (resistant to outliers or heteroskedasticity) and non-parametric
- vuongf
  2006-03-12
Vuong test, example with FIML.
- vuong
  2006-03-12
Vuong test of non-nested models. Computed from difference in LogL for each observations. Example with OLS.
- lad2sk
  2004-04-08
2-stage LAD estimation of Klein-I consumption equation
- wtdsampl (I)
  2003-09-19,1997-12 (proc)
Randomly sample from a vector with non-uniform weights. Similiar to random(draw=). Proc WSM, with example of using it.
- wild
  2003-05-08
Wild bootstrap, used to approximate the distribution of a test statistic. (RANDOM)
- list7ch3
  2003-05-01
Programming with subscripted lists, to choose up to 3 variables to add to a regression. To reproduce Levine-Renelt 1992 EBA results. (LIST)
- neural
  2003-04-30
Neural network regression on Stackloss dataset. Logistic function of RHS variables with 2 nodes. (LSQ)
- kerlin
  2002-07-18
Outline for computing Partially Linear Regression by Robinson. Should be revised to use KERNEL command in TSP 5.0.
- probks2 (F)
  2002-04-12
Semiparametric Probit (Klein and Spady) on large dataset (2339 obs.). Should revise to use KERNEL command in TSP 5.0. Matrix version.
- probks (F)
  2002-04-12
Semiparametric Probit (Klein and Spady) on small dataset (32 obs.). DO loop version.
- spline3
  2002-03-22
Cubic spline with 3 segments. Examples of fitting sin(6x) and log(.1+x). (LSQ,GRAPH)
- splsbic
  2002-03-18 (proc)
Cubic spline which chooses the number of segments by minimizing SBIC. Examples of fitting sin(6x) and log(.1+x). (OLSQ,GRAPH)
- odr2 (I)
  2002-02-27
Orthogonal Distance Regression - simpler estimation which avoids the N nuisance parameters. (ML)
- glejser
  2001-04-25 (proc)
Glejser and MSS tests for heteroskedasticity in quantile regression. by Bronwyn Hall (LAD)
- gmac2
  2001-01-12,2000-12 (proc)
Chow test with simple heteroskedasticity - MAC2 test from Thursby(1992), Proc example on Grunfeld data. Outdated by REGOPT CHOWHET in TSP 5.0.
- wilcoxon
  2000-10-13,1998-11 (proc)
Wilcoxon signed rank test, with p-value. Nonparametric test for symmetry of a series around a given value.
- signtest
  2000-10-12 (proc)
Sign test for median of zero, with exact binomial p-value
- opac (Q)
  2000-08-17 data: counta.zip
Ordered Probit with AutoCorrelation-robust SEs (ORDPROB,DIFFER,GMM)
- scls (J)
  2000-03-28,1999-04 (proc)
Symmetrically Censored Least Squares - proposed by Powell (1986) for Tobit model estimator robust to non-normality. The Newton algorithm here improves its iteration performance greatly. Includes test dataset. by Joao Santos Silva, of UTL/ISEG, Lisbon.
- winsor
  1999-12-06
Winsorized residuals, and iterative M-estimation. A simple iterative version.
- ktau
  1999-10-14,1996-03 (proc)
computes Kendall's tau-b (nonparametric correlation), and its standard error. Compares with Spearman rank correlation, and regular Pearson correlation. Includes Proc to compute number of ties, and an improved Rank Proc which accounts for ties.
- changept (T)
  1999-09-27
Andrews (1993) test for structural change with unknown change point (Maximum Wald test). Includes a Monte Carlo loop to verify that distribution of the test matches his results.
- panboot (P)
  1999-02-09
Panel bootstrapping. Draws residuals within an individual.
- jb
  1998-09-04
Reproduces Jarque-Bera normality test, starting from small-sample versions of @SKEW and @KURT stored by MSD.
- student
  1998-05-26
regression with Student t residuals; see also stacklos example.
- stacklos
  1997-09-12
LAD and Student's t residuals on classic Stack Loss dataset (LAD,ML)
- kercc
  1997-08-04
gaussian kernel regression - version with kronecker product. Fast and concise but memory intensive - only good for relatively small samples (up to 500 obs?) Also illustrates DOT trick for using GRAPH in a loop with different TITLE strings (up to 8 chars). Outdated by KERNEL in TSP 5.0.
- mbbjex3
  1997-06-17
moving blocks bootstrap (examples with OLS and LAD). Similar to plain bootstrap, but handles autocorrelation as well as heteroskedasticity. by Bernd Fitzenberger
- kernel
  1995-12-14
gaussian kernel density estimation and regression, by Joao Santos-Silva (compare with kercc above). Outdated by KERNEL in TSP 5.0.
- rankcorr
  1995-06-30,1993-01 (proc)
revised version of old rankcorr example. This one uses the RANK option in the SORT command, instead of defining a separate RANK Proc. See the ktau example for an improved rank correlation, which handles ties correctly.
- odr (I)
  1994-02-16
Orthogonal Distance Regression (errors in variables, when ratio of error variances in Ys and Xs is known). (FORM,EQSUB,ML)
B - Benchmarks - reproducing results
- ar2mlp
  2004-11-28
regression with AR(2) residual, exact ML estimation. Uses both ML and ML PROC, with the new BJEST option which allows general ARMA residuals. Klein-I consumption function data.
- dw245
  2004-03-02
Compute DW 5% critical values for n=245, k=2 to 10, using CDF(WTDCHI).
- dw200
  2004-03-02
Verify DW 5% critical values for n=200, k'=2,3,4, using CDF(WTDCHI).
- dw10
  2004-03-02
Verify DW critical values for n=10, k'=1, using CDF(WTDCHI).
- kleinf (I)
  2002-09-09
Reproduces pseudo-F test for zero slopes in 2SLS, example using Klein Model I.
- aids (M)
  2002-06-13
Almost Ideal Demand System, with elasticities, Deaton and Muellbauer model, based on SAS example. (LSQ,EQSUB,ANALYZ)
- divzero
  2002-03-05
reproduces DIVIND calculation with zero quantities.
- kleinphi
  2001-07-25
reproduces 3SLS @PHI objective function with matrix commands.
- wtdrsq
  2001-06-12,1997-06
reproduces @RSQ from a weighted OLS regression, using OLSQ on manually weighted data and MSD. (CORR,MATRIX)
- ovid (I)
  2000-11-11
Overidentification tests in 2SLS - examples using Klein I (recently added to TSP 4.5)
- skew
  2000-06-21
Reproduce Skewness and Kurtosis equations from MSD in manual.
- joh1 (U)
  1999-09-30,1994
Reproduces Johansen-Juselius cointegration results for Finnish data. Originally by David Cushman. (VAR,MATRIX)
- condnum (I)
  1998-10-30,1998-01 (proc)
Condition number of X'X or any @VCOV matrix (version which is independent of the scale of X). Example using Klein-Goldberger consumption data. The condition number is a measure of multicollinearity.
- jb (R)
  1998-09-04
Reproduces Jarque-Bera normality test, starting from small-sample versions of @SKEW and @KURT stored by MSD.
- spatcal (M)
  1997-12-05 uses: spatial
Example of running spatial.tsp on California plant species data. Reproduces results for Spatial AutoCorrelation and Spatial AutoRegression from Upton and Fingleton (1985).
- kleinlmc
  1997-09-27
Klein-I LIML benchmarks on consumption equation. Reproduces Greene's coefficients, but not his standard errors. Explores alternative standard errors to those produced by the LIML command.
- longley
  1997-08-12
Longley benchmark with double precision data; compares precision of default orthonormalized regression (11+ digits) with plain (X'X)"(X'Y) regression (7-9 digits)
- prin
  1997-06-05
reproduces results from PRIN (principal components), with MATRIX commands
- panhaus
  1997-02-13 data: PATDATA.DAT
reproduces Hausman test of RE vs. FE in panel data (ANALYZ,MATRIX)
- dh
  1997-02-11
reproduces Durbin's h statistic
- ppenders (U)
  1996-10-24 uses: ppzt
ppzt on data from 4 countries. Mostly reproduces table on p.263 of Enders, "Applied Economic Time Series", 1995
I - Miscellaneous
- interp2
  2007-03-07
Linear interpolation of missing values, general case.
- test_suits
  2006-04-24
Suits transformation of dummy variables (average effect for first dummy, difference from average for others). By Bronwyn Hall.
- wls_tx04
  2005-10-14
standard errors for predicted values from WLS
- plotac (T)
  2004-09-16,1996-09 (proc)
Proc which can be called after BJIDENT to print the autocorrelation function (and its 95% bounds) with color graphics. (BJIDENT,GRAPH)
- kleinchow
  2004-09-07
multiequation Chow tests on Klein-I model - parameter stability in SUR and 3SLS using LR and QLR tests.
- pi
  2004-05-12
Various infinite series for computing pi to arbitrary precision.
- fisher
  2004-04-26
Paasche, Laspeyres and Fisher price/quantity indices. Compare with DIVIND command. (original 12/95, updated 4/04 to document plist, qlist)
- wtdsampl
  2003-09-19,1997-12 (proc)
Randomly sample from a vector with non-uniform weights. Similiar to random(draw=). Proc WSM, with example of using it.
- lp
  2002-11-28
Very simple linear programming, using SIML. Outdated by LP command in TSP 5.0.
- kleinf
  2002-09-09
Reproduces pseudo-F test for zero slopes in 2SLS, example using Klein Model I.
- gini
  2002-08-11,1992-11 (proc)
Gini index (income distribution).
- spline3 (R)
  2002-03-22
Cubic spline with 3 segments. Examples of fitting sin(6x) and log(.1+x). (LSQ,GRAPH)
- splsbic (R)
  2002-03-18 (proc)
Cubic spline which chooses the number of segments by minimizing SBIC. Examples of fitting sin(6x) and log(.1+x). (OLSQ,GRAPH)
- odr2
  2002-02-27
Orthogonal Distance Regression - simpler estimation which avoids the N nuisance parameters. (ML)
- multinom
  2002-11-20 (proc)
draws multinomial r.v.s for user specified probabilities. by Bronwyn Hall
- clt
  2002-11-08
Central Limit Theorem example - convergence of mean of uniform r.v.s to normality. (RANDOM,MSD,HIST)
- dotfile
  2002-10-08
using DOT loops to construct filename(s). Double DOTs to concatenate strings.
- omnorm
  2001-05-31 (proc)
Omnibus test for multivariate normality. Reproduces results from Doornik and Hansen (1994) for Fisher Iris data. (MATRIX)
- exog
  2001-05-23,1998-12
Exogeneity test (Hausman-Wu), and also Breusch-Godfrey LM test for autocorrelation in 2SLS.
- rantrunc
  2001-02-21
truncated normal r.v.s via inverted CDF.
- dateloop
  2000-11-21
looping over a dated sample - simpler than doquart example, and explains 2 methods (DO,SELECT,SMPL)
- ovid
  2000-11-11
Overidentification tests in 2SLS - examples using Klein I (recently added to TSP 4.5)
- submat
  2000-10-13 (proc)
extract submatrix (Proc), given starting/ending row/column
- coeftab
  2000-07-24
printing a small table of selected coefs and SEs from a large estimation, by using ANALYZ
- int
  2000-06-26
Integration using trapezoidal rule approximation in a DO loop.
- gnuplot
  2000-03-05
gnuplot graphics - .GIF file output only, unix versions. (PLOT,GRAPH)
- gnuploti
  2000-03-05
gnuplot graphics - X window output, unix versions. (PLOT,GRAPH)
- ss9b
  2000-03-05
gnuplot graphics - GRAPH of SAMPSEL LogL with multiple local optima.
- ovid
  2000-12-28
Computes several overidentification and pseudo-F tests in 2SLS. by Clint Cummins and Bronwyn Hall
- addfac
  1999-07-13
Add factor forecasting. Uses EQSUB to add the add factor variable to an existing estimated equation. (OLSQ,FORM,GENR)
- addfactor
  1999-05-11
Estimation and forecasting with an add factor, on the same equation. (The coefficient on the add factor is zero during estimation, and one during forecasting). (LSQ,SIML)
- subsets
  1998-11-24 (proc)
OLS on all subsets of the RHS variables. Computes X'X once, and then uses submatrices to compute regression coefficients and SSR. Returns the set of coefficients which minimizes SBIC.
- condnum
  1998-10-30,1998-01 (proc)
Condition number of X'X or any @VCOV matrix (version which is independent of the scale of X). Example using Klein-Goldberger consumption data. The condition number is a measure of multicollinearity.
- cubic
  1998-08-12
Equations for real roots of cubic equation. Also demonstrates imposing various constraints. (EQSUB,LSQ)
- percent
  1998-07-27
Arbitrary quantiles (such as 5%, 95%), using sort.
- listsort
  1998-07-09
Creates a LIST (R8 R5 R6 ...) from a vector of integers (8 5 6 ...).
- interp
  1998-04-28
Linear interpolation of missing values, for very simple case of single isolated missing values. Discusses why this is not a very good idea. See interp2 for general case.
- sbic (V)
  1998-02-19
Shows 3 different normalizations for SBIC and AIC, and which one TSP 4.4 uses in OLSQ. In TSP 4.5, we switched to using the unnormalized SBIC and AIC.
- tab2
  1997-10-16 (proc)
Forms and print 2 x 2 contingency table (crosstab), with ChiSq(1) test for independence. Inputs are 2 dummy variables.
- tab2t
  1997-10-16 uses: tab2
Examples of calling tab2.
- finance
  1997-08-21
Financial applications: 1. saving and sorting 60 betas 2. estimates of variance in rolling sample 3. standard deviation of sequential portfolios 4. t-stat for correlation coefficient, by Sotiris Staikouras
- analyzr
  1997-05-23
using the restricted coefs stored by ANALYZ
- stack2
  1997-01-30 (proc)
Procs which stack 2 matrices (vertically or horizontally). Outdated by MMAKE in TSP 4.4 (for stacking 2 or more matrices horizontally).
- merge
  1996-07-31 (proc)
Proc which merges two samples by ID variables
- bandm
  1995-12-15
creates a banded symmetric matrix from its first column. Outdated by MFORM(BAND) in TSP 4.4.
- analyzf
  1995-11-02
computes an F-statistic for testing a group of variables with ANALYZ. Compares with the method of running the restricted regression. Outdated by ANALYZ in TSP 4.5.
- anova
  1995-10-26 (proc)
Proc which prints a (formatted) "ANOVA table" after OLS
- probdist
  1995-09-01
compute various probability distributions and plot them. by Bronwyn Hall
- listsave
  1995-08-04
writes a LIST into an external file, formatted as a TSP command. Messy, but the only way to save a list in an external file at present. Could be useful if you are saving an @VCOV matrix in a databank, and you also want to save the @RNMS parameter names for later use by ANALYZ in a separate run.
- sortl
  1995-06-12
sorts a list of variable names, by the variables' values in a given period. Coding similar to listsave.
- freqsav
  1995-04-24
a way to save and restore the frequency (for use at start and end of a Proc). Outdated by FREQ and @FREQ in TSP 4.3.
- ridge
  1995-01-11 (proc)
Bayesian mixed estimator (combines prior with estimated coefficients and VCOV), works for non-OLS models.
- delobs
  1994-10-05
deletes some observations permanently from a dataset
- quintile
  1994-08-04 (proc)
sample Quintiles (20%, 40%, ...) via SORT. Similar to percent example.
- gmmvar
  1994-06-08
VCOV for GMM with non-optimal COVOC (Hansen Theorem 3.1). Outdated by GMM(NOOPTCOV) in TSP 4.4.
- doquart
  1994-05-12
DO loop over time periods with quarterly data. Example with rolling regression and one-period-ahead forecasts. See the dateloop example for a simpler loop.
- odr
  1994-02-16
Orthogonal Distance Regression (errors in variables, when ratio of error variances in Ys and Xs is known). (FORM,EQSUB,ML)
- median
  1993-01-01
median via SORT command. Outdated by MSD(ALL) in TSP 4.2B.
- phichow
  1993-01-01
Chow test for 2SLS (pseudo-F test for parameter stability, split sample)
- illus41
  1992-10-05
illustrative model from the TSP 4.2 manual (AR1,2SLS,LIML,LSQ,FIML,ANALYZ,SIML)
tspex.zip
Download all examples in unix .zip format.
(On PC or Mac, use unzip -a to add proper
end-of-line characters.)
In case you are downloading to a PC, and your
unzip program does not support the -a option
(such as PKUNZIP), here is a freeware unzip which
supports -a:
unzip.zip
(includes both UNZIP.DOC and UNZIP.EXE)
UNZIP.DOC
UNZIP.EXE
This page was created with Fortran.