Limdep is a general-purpose statistics program that comes with an optional module named NLOGIT for estimating discrete-choice models. Available from Econometrics Software, this impressive program and accompanying text were written by Dr. William H. Greene at New York University . NLOGIT can estimate a number of choice-model variants, such as random parameters (i.e., mixed) logit, nested logit, multinomial probit and heteroscedastic extreme value. It also supports panel data models for repeated choice situations, multi-period probit and time variation in panel mixed logit. For this introduction and brief tutorial, however, we will focus on the estimation of nested logit (NL) and random parameters logit (RPL) models.
We will use the sample data file Shoe responses.xlsx, installed with the Data Wizard. You can load this worksheet by following the path Start | All Programs | StatWizards | Data Wizard | Tutorial files and clicking on the file name. The worksheet contains a hypothetical study of a fictional shoe market. A fragment of the file appears below.
We will use the version that the Data Wizard produces at step 5, as shown below.
If you don't feel comfortable getting to this point, review the tutorial on the Data Wizard. You know you are at this point when you run the Data Wizardby pressing Ctrl-Shift-D or by selecting Tools | Set Up Discrete Choice Data from Excel's menu and see the following dialog box.
From this point, using the drop-down box in panel A, select Limdep *.csv input file, so that the dialog box now looks like this:
Click the Create Files button in panel B. After some processing time, you will see the following pop-up dialog box:
This tells you exactly what the wizard has done and what you need to do next. Because this window contains so much information, we recommend clicking the Copy to Word button to save the text as a Word document. If you do this you will see another pop-up window telling you where this Word file is located.
Click on the OK button to close this window, then click on the Finish button to close the wizard. You will see that your Excel workbook has a new sheet titled Limdep data. The sheet should look something like this:
Now run NLOGIT. Consult your documentation if you are unsure how to do this. If successful, you should see the following screen:
Now from LIMDEP's menu, select Project | Settings.... A dialog box titled Project Settings opens.
Refer to the dialog box titled Successful completion that appeared some distance above. A portion of that text reads:
Before running the command file, start Limdep, then select Project | Settings... from the menu. In the field labeled "Number of Cells:" enter 2560000. The field labeled "Rows:" should contain approximately 12801. For your convenience, I have copied the value 2560000 to the clipboard. Check that the field labeled "Columns:" contains 200. If you are using version 8 or later of Limdep, you will have to type 12801 into the "Rows:" field, and the number of variables can exceed 200. With version 8, you may have to adjust the project size to accommodate all the variables you want to use.
Follow these instructions, so that the entries in the dialog box look like this:
Next, you'll see a warning message.
Click OK to close the dialog box and save the settings.
From LIMDEP's menu, select Run | Run Files.... You should see an open-files dialog box such as the one below. Navigate to the command file 01ReadXL.lim that the Wizard created for you. The dialog box should resemble the one below.
Click the Open button to close the dialog box and run the command file, which will load your data set. Your test file is small, so it should load quickly. You should see:
At this point, you can load either of the templates and begin specifying and estimating your model. If you are interested in estimating random parameters (i.e., mixed) logit models, click here. Otherwise, continue below.
Using command file templates.
As a timesaving aid, the Data Wizard creates two template command files that let you get started modeling quickly. The first, named NestedTm.lim, is for a nested logit estimation for a model containing a buy / no-buy nest. The second, named RPLTmplt.lim, is for a random parameters (i.e., mixed) logit estimation. To load either file, select File | Open from Limdep's main menu.
Double-click on NestedTm.lim to load it. You should see the file's contents, as shown below.
This is just a template, but it should execute perfectly well. Bear in mind that its real value is to show you how to set up a nested logit estimation. It does not pretend to be the final specification you will likely use. Using the template as a starting point, though, you can delete rows, add different nests, or make any other changes you want.
Our final specification for a nested logit estimation of the shoe data is shown in the file NestedFinal.lim, which was placed on your hard drive when you installed the Data Wizard. The file, which appears below, contains some interaction variables that we constructed using a CREATE statement.
Compare this file to the template and you will notice some differences. First, we estimated a single constant rather than an alternative-specific constant. Second, we eliminated Male, an insignificant variable. Third, we added the interaction variables mentioned above. Even with these changes, having the template saved us considerable time over starting from scratch.
To run this command in NLogit, press Ctrl-A to select all the lines in the file and Ctrl-R to execute those lines. The resulting output appears below.
All variables have the expected signs, although the Inclusive Value (IV) parameter statistics suggest that this is really a simple logit problem.
Along with this template, the Data Wizard constructs a similar template for estimating an RPL model using this same data set. To see an example, click here. Also, you might find it interesting to compare the above model to its RPL counterpart.