Thursday, September 06, 2007 - Posts

Stata scripts to automate Latent Gold processing, updated

After releasing the first version of the LG auto-processing scripts in late July, I had been constantly making improvements to them, and distributed five more major releases by the end of August. The last version is v6.4.

The most convenient feature I added to the latest version is a new master do-file (master_lg_all_test_thepit.do) which can perform all tasks under Windows with minimal human intervention. I made use of the Windows version of Stata, so that I could run LG from my Stata do-file, and no longer need to manually copy files back and forth.

There is actually one tricky thing, when our working directory is on a remote file server. To run LG from Stata, I wrote a batch file and used the shell command to execute it. The shell command will invoke a command line window (cmd.exe) to execute the command, but cmd.exe cannot start from a UNC path (such as \\some\path or //some/other/path). The shell command would fail to run the batch file if the current dir is a UNC path, although such a path would work fine in Stata. The solution is to change the current working dir to a dir which is local to the hard drive (something like C:\Temp), and run the batch file. Fortunately, we can specify full (UNC) paths in both the batch file and the LG model file (*.lgf), so that all I/O files can be accessed via UNC paths.


Other improvements along the upgrade history include
  • Supporting Class-Independent effect and Continuous Factors in LG model file.
  • Better support on "choice'' models, in addition to the original "rating" one.
  • Handling model parameter output files (*.lst) properly when there is no intercept or more than two intercepts.
  • Adding several options to make the code flexible for various running purposes
Updates about the SED script to process LG output is available at here.

posted by wenyang with 0 Comments