go to Trig home page   GAUSS code go to Aptech home page
This code was written by Felix Ritchie over the period 1991-1998. All code on this page is being reviewed and revised. It generally still seems to works but the XPReg program has an imcompatibility with GAUSS 5.0 (a problem creating arrays of variable names for output). The code has not been extensively tested on the latest versions of GAUSS. Comments gratefully received. This code can be freely used, with appropriate citation.



This code was developed as part of Felix' PhD thesis and for other projects at the University of Stirling over the period.

It provides for linear analysis of cross-section and panel data models, with or without instrumental variables (IV), and allowing for the creation of lagging and leading variables. Models include
  • simple OLS regression, standard and covariance
  • Simple panel fixed-effects, covariance and differencing estimators
  • Time-varying fixed-effects: panel regression with unrestricted periodical variation in the parameter
  • Pooled single-equation differenced estimator: potentially more efficient system differencing estimator
  • Chamberlain's minimum distance estimator; not fully implemented
  • First and second stage linear SURE model
Please note that this was an ongoing series of research projects. Version 7 was complete and fully working, but version 8 was not fully implemented as in 1998 Dr Ritchie left academia to focus on IT consulting. In particular IV estimation, fully implemented on earlier versions of the program, is only partially implemented.

Originally XPReg was designed to work on a cross-product matrix, as for security reasons the raw data was unavailable. It still does this, but it now also works on a standard GAUSS matrix. The regression models available obviously depend upon the type of matrix, and so it does ask many questions.

In due course the program will be reviewed, revised and (possibly) resurrected, but this is not scheduled to happen in the very near future. Please note that the user manual relates primarily to version 7, rather than the unfinshed version 8. For the workings of version 8, please consult the relevant discussion papers or contact Dr Ritchie.

In the meantime, the downloads available from here are:
  • Version 7 source code, zipped
  • Version 8 source code, zipped
  • User manual in PDF, zipped WPWin or zipped MS Word formats.
  • Relevant University of Stirling discussion/working papers (latest versions, zipped WPWin files):
    • DP 95/12: Efficient Access to large datasets for linear regression models
      Theory behind using cross-products and TVFE model
    • DP 96/11: Time-varying parameters in panel models
      The TVP methodology
    • DP 97/04: Fixed-effects in static models: deviations or differences?
      Theory of differencing and PSED differenced estimator
  • XPOutFmt.gp: a program to format the output from XPReg for importing into spreadsheets
There are also a few programs about to manipulate cross-product matrices, combining rows, creating dummy variables and so on. These are all development utilities, but can be obtained by emailing Felix Ritchie.



These general purpose utilities, implemented in procedures, are all in ASCII text. They are also mostly contained in the source code zips for the XPReg program.
  • IOUtils.gl: file handling
  • DataUtil.gl: ragbag of routines: read (possibly non-null) prompted input string or Y/Ns, get numbers with more flexibility than CON, check whether file exists, query for name of existing file, print warning message etc
  • BitOps.gl: bit-based set operations: test bit, set bit, emptyset
  • SelDelFR.gl: replicates SELIF and DELIF but (a) requires much less memory and (b) works on correct definition of logical calculation (ie 0-not 0 rather than 0-1). Also duplicate routines which do not use PACKR, hence can be used on matrices with missing values
  • SingColl.gl: Singularity/multicollinearity tests for cross-product matrices; uses fuzzy equivalence. Reference for multicollinearity test in comments.
  • Constant.gl: constants used by some of these files
  • Options.gl: options used by some of these files
  • MakeXX.gl: routine to create cross-product matrices