revealPref | R Documentation |
Given a random sample of choice problems and choices, revealPref
returns test statistics, critical values and p-values against a collection of preferences.
Five methods for choosing critical values are available:
(i) GMS
: generalized moment selection (plug-in (estimated) moment conditions with shrinkage);
(ii) PI
: critical values based on plug-in estimated moment conditions (this is not uniformly valid);
(iii) LF
: critical values based on the least favorable model (plug-in 0 for the moment conditions);
(iv) 2MS
: two-step moment selection;
and (v) 2UB
: refined moment selection (plug-in upper bound of moment inequalities).
sumData
is a low-level function that generates summary statistics, and
genMat
can be used to construct the constraint matrices. The simulated dataset
ramdata
is also provided for illustration. For revealed attention analysis, see revealAtte
.
revealPref( menu, choice, pref_list = NULL, method = "GMS", nCritSimu = 2000, BARatio2MS = 0.1, BARatio2UB = 0.1, MNRatioGMS = NULL, RAM = TRUE, AOM = TRUE, limDataCorr = TRUE, attBinary = 1 )
menu |
Numeric matrix of 0s and 1s, the collection of choice problems. |
choice |
Numeric matrix of 0s and 1s, the collection of choices. |
pref_list |
Numeric matrix, each row corresponds to one preference. For example, |
method |
String, the method for constructing critical values. Default is |
nCritSimu |
Integer, number of simulations used to construct the critical value. Default is |
BARatio2MS |
Numeric, beta-to-alpha ratio for two-step moment selection method. Default is |
BARatio2UB |
Numeric, beta-to-alpha ratio for two-step moment upper bound method. Default is |
MNRatioGMS |
Numeric, shrinkage parameter. Default is |
RAM |
Boolean, whether the restrictions implied by the RAM of
Cattaneo et al. (2020) should be incorporated, that is, their monotonic attention assumption (default is |
AOM |
Boolean, whether the restrictions implied by the AOM of
Cattaneo et al. (2022) should be incorporated, that is, their attention overload assumption (default is |
limDataCorr |
Boolean, whether assuming limited data (default is |
attBinary |
Numeric, between 1/2 and 1 (default is |
sumStats |
Summary statistics, generated by |
constraints |
Matrices of constraints, generated by |
Tstat |
Test statistic. |
critVal |
Critical values. |
pVal |
P-values (only available for |
method |
Method for constructing critical value. |
Matias D. Cattaneo, Princeton University. cattaneo@princeton.edu.
Paul Cheung, University of Maryland. hycheung@umd.edu
Xinwei Ma (maintainer), University of California San Diego. x1ma@ucsd.edu
Yusufcan Masatlioglu, University of Maryland. yusufcan@umd.edu
Elchin Suleymanov, Purdue University. esuleyma@purdue.edu
M. D. Cattaneo, X. Ma, Y. Masatlioglu, and E. Suleymanov (2020). A Random Attention Model. Journal of Political Economy 128(7): 2796-2836. doi: 10.1086/706861
M. D. Cattaneo, P. Cheung, X. Ma, and Y. Masatlioglu (2022). Attention Overload. Working paper.
# Load data data(ramdata) # Set seed, to replicate simulated critical values set.seed(42) # list of preferences pref_list <- matrix(c(1, 2, 3, 4, 5, 2, 1, 3, 4, 5, 2, 3, 4, 5, 1, 5, 4, 3, 2, 1), ncol=5, byrow=TRUE) # revealed preference using only RAM restrictions result1 <- revealPref(menu = ramdata$menu, choice = ramdata$choice, method = "GMS", pref_list = pref_list, RAM = TRUE, AOM = FALSE) summary(result1) # revealed preference using only AOM restrictions result2 <- revealPref(menu = ramdata$menu, choice = ramdata$choice, method = "GMS", pref_list = pref_list, RAM = FALSE, AOM = TRUE) summary(result2) # revealed preference using both RAM and AOM restrictions result3 <- revealPref(menu = ramdata$menu, choice = ramdata$choice, method = "GMS", pref_list = pref_list, RAM = TRUE, AOM = TRUE) summary(result3) # revealed preference employing additional restrictions for binary choice problems result4 <- revealPref(menu = ramdata$menu, choice = ramdata$choice, method = "GMS", pref_list = pref_list, RAM = TRUE, AOM = TRUE, attBinary = 2/3) summary(result4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.