Description Usage Arguments Details Value Author(s) References See Also Examples
Functions for generating random data (prices and quantities) consistent with the chosen rationality axiom.
1 2 3 4 5 6 
nobs 
the desired number of observations (number of rows in the quantities and prices matrices), 
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, 
maxit 
maximum number of iterations (default to 10 times 
qmin 
minimum quantities for each good, 
qmax 
maximum quantities for each good, 
pmin 
minimum prices for each good, 
pmax 
maximum prices for each good. 
The data are iteratively incremented: at each iteration a new random observation (prices and quantities) is generated, and is accepted only if it is consistent with the previously accepted data, in which case it is added to the data. The random observations (pricequantities couples) are independently generated from uniform distributions in the support defined by qmin
, qmax
, and pmin
, pmax
.
For GARP and SARP the depthfirst search method is used to check for consistency (a recursive search using only the new candidate observation as starting point), for WARP the candidate observation is pairwise checked against all previously accepted data.
The algorithm stops if the desired number of observations nobs
is reached. If the desired number of observations nobs
is not reached in maxit
iterations, a warning is issued and the function returns the largest dataset attained.

numeric matrix of generated quantities, 

numeric matrix of generated prices, 

number of iterations before the algorithm stopped, 

number of generated observations. 
Julien Boelaert jubo.stats@gmail.com
Varian, H. R. (1982) The Nonparametric Approach to Demand Analysis, Econometrica, 50(4):945973.
Varian, H. R. (1984) Microeconomic Analysis. New York/London: Norton, 2nd edition, pp 141143.
See checkGarp for rationality tests.
1 2 3 4 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.