simPrefs: Generate random data according to a given matrix of direct... In revealedPrefs: Revealed Preferences and Microeconomic Rationality

Description

Function for generating random data (prices and quantities) consistent with a given direct preferences matrix.

Usage

 1 2 3 simPrefs(pref.mat, ngoods, afriat.par= 1, qmin= 0, qmax= 1, pmin= 0, pmax= 1, maxit= 100, verbose= FALSE)

Arguments

 pref.mat the desired matrix of direct preferences (must be a square matrix, see details), ngoods the number of goods in the dataset (number of columns in the quantities and prices matrices), afriat.par the Afriat parameter, a real number in [0,1], which allows a certain level of error in the optimization of choices; default is 1, ie. no optimization error allowed, qmin minimum quantities for each good, qmax maximum quantities for each good, pmin minimum prices for each good, pmax maximum prices for each good, maxit maximum number of iterations of the optimization algorithm (default to 100), verbose logical value: if TRUE a trace of the optimization algorithm is printed.

Details

The input pref.mat must be a square matrix, with number of rows equal to the number of desired observations. All entries must be either 0, 1, or 2. The interpretation of the matrix is the same as in function directPrefs:

pref.mat[i, j] = 0 if bundle i is not revealed prefered to bundle j

pref.mat[i, j] = 1 if bundle i is revealed prefered to bundle j

pref.mat[i, j] = 2 if bundle i is strictly revealed prefered to bundle j.

All diagonal entries of pref.mat must be 1 (each bundle is revealed prefered to itself), except when afriat.par is strictly less than 1.

The simulated data (quantities and prices) are obtained by particle swarm optimization (of package pso). Fitness must reach 0 for the data to be consistent with the preference matrix. If optimization fails, a warning is issued.

Value

 x numeric matrix of generated quantities, or NULL if optimization fails, p numeric matrix of generated prices, or NULL if optimizaiton fails.

Author(s)

Julien Boelaert jubo.stats@gmail.com

References

Varian, H. R. (1982) The Nonparametric Approach to Demand Analysis, Econometrica, 50(4):945-973.

Varian, H. R. (1984) Microeconomic Analysis. New York/London: Norton, 2nd edition, pp 141-143.