Professors Edward Morey and Anders Karlstrom

(Ander's web page is )

Programs and data related to implemenation of the expected expenditure formula for calculating

E[cv] in GEV discrete-choice models with income effects

This page contains materials relating to the paper
Using the expected expenditure formula to calculate the exact expected compensating variation in GEV random utility models with income effects: a primer
Anders Karlstrom and Edward Morey, May 28, 2003


Potentially useful sections that have been deleted from the paper to reduce length
A section on "a simple improvement" that was deleted from the paper (pdf version)
A section on "a simple improvement" that we deleted from the paper (Scientific Word (.tex) version)


Code to calculate the expected compensating variation from models with income effects is provided in both OX and Gauss (in progress).


OX is a mathematical and statistical package developed by Jurgen Doornik ( that is available free for academic use.

Anders is a user of and booster for Ox. It is quite cool.


This page contains Ox programs and data files that can be downloaded

Comparable Gauss programs are in process and will be added in the future (if you are writing such a Gauss program, let us know).



Downloading and using Ox


The most recent version of the free version of Ox ("Console version") can be downloaded from

versions are available for Windows, Linux and Sun.

The free version is called the "Console version"

You will also be asked if you want to download "OxEdit" (your answer should be yes). OxEdit allows one to easily edit and run programs.

You will also want to check out "Introduction to Ox". It will be listed when you open Ox. It is a .pdf file.


To get started with Ox, open the downloaded file "Program Files\Ox\doc\index.html" in your web brower


Ox files, *.ox can be viewed in any text editor and edited and run using OxEdit


Even if you are familiar with Gauss, you might consider using our Ox code to estimated your E[cv]'s

Ox can directly read in Gauss data sets, matrices, and even Gauss code

In addition, it is quite similiar to Gauss and not difficult to learn. The documenation is excellent. So is the "Help" section


Ox programs and data files files needed to run our E[cv] programs

that is, program files that you need to download and save in a directory


ExpectedCV.ox (this ox program defines the function/program "main()" that calculates and prints the E[cv]'s. In addition it defines

a number of functions that are used by main)


Romberg_.ox (this ox program defines a number of functions called by ExpectedCV.ox)


solve_.ox (this ox program defines a number of functions called by ExpectedCV.ox)


data and parameter files that you need to download


x.mat (this file contains the Maine data set in .mat format. It is in an ASSCI data file that starts with the number of row and columns

in the data matrix, then lists the elements of the data matrix, row by row)


b_IncE.mat (this file contains the estimated parameter values for our model)


Running and modifying the Ox programs


We would start by reading throught the first couple of chapters of Introduction to Ox (you downloaded it)


After downloading all of the above files to the same directory, open OxEdit

In OxEdit, open the file ExpectedCV.ox. (you won't need to explicitly open Romberg.ox or solve.ox)

Then run ExpectedCV.ox, as is, by opening "Modules" and clicking "Default Module"

This will run the program and create an output file that will print to your screen.

The column of output is the E[cv]'s for halving the Penobscot catch rate for each individual in the sample.


The Ox files contain extensive comments to help the uninitated


Now try modifying the program to caluclate the E[cv]'s for a different policy scenario (see the function "PolicyChange()")


Once you are comfortable with running the program for our application, the code contains extensive comments on how the program would

need to be modified for another application.


Good luck. Take it a step at a time. Please send us your suggestions on improving the code. Thanks.


For help with modifiying our code to fit your application, email your queries to Anders Karlstrom or Edward Morey. (Anders is the expert on Ox)


Doing it in Gauss

coming soon
Looking ahead: Ox can read in Gauss code, so this is one option.

Contact me via email | Table of Contents | Home Page | Top of Page

Last Update: 09-01-03 visitors since May 2003