Title: | Revealed Preference and Attention Analysis in Random Limited Attention Models |
---|---|
Description: | It is widely documented in psychology, economics and other disciplines that socio-economic agent may not pay full attention to all available alternatives, rendering standard revealed preference theory invalid. This package implements the estimation and inference procedures of Cattaneo, Ma, Masatlioglu and Suleymanov (2020) <arXiv:1712.03448> and Cattaneo, Cheung, Ma, and Masatlioglu (2022) <arXiv:2110.10650>, which utilizes standard choice data to partially identify and estimate a decision maker's preference and attention. For inference, several simulation-based critical values are provided. |
Authors: | Matias D. Cattaneo, Paul Cheung, Xinwei Ma, Yusufcan Masatlioglu, Elchin Suleymanov |
Maintainer: | Xinwei Ma <[email protected]> |
License: | GPL-2 |
Version: | 2.2 |
Built: | 2025-01-29 04:07:29 UTC |
Source: | https://github.com/cran/ramchoice |
Information about socio-economic agent's preference (consumer, firm, organization, voter, etc.) is important not only for understanding the decision-making process, but also for conducting welfare analysis and providing robust policy recommendations. However, it is widely documented in psychology, economics and other disciplines that decision makers may not pay full attention to all available alternatives, rendering standard revealed preference theory invalid.
This package implements the estimation and inference procedures documented in Cattaneo, Ma, Masatlioglu, and Suleymanov (2020), and Cattaneo, Cheung, Ma, and Masatlioglu (2024), which utilize standard choice data to partially identify decision maker's preference and attention. For statistical inference, several simulation-based critical values are provided.
The following functions are provided: revealPref
and revealAtte
(the main functions for revealed preference and attention analysis),
sumData
, genMat
, logitAtte
, logitSimu
.
A simulated dataset ramdata
is also included for illustration purposes.
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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 (2024). Attention Overload. Working paper.
genMat
generates constraint matrices for a range of preference orderings according to
(i) the monotonic attention assumption proposed by Cattaneo, Ma, Masatlioglu, and Suleymanov (2020),
(ii) the attention overload assumption proposed by Cattaneo, Cheung, Ma, and Masatlioglu (2021),
and (iii) the attentive-at-binaries restriction.
This function is embedded in revealPref
.
genMat( sumMenu, sumMsize, pref_list = NULL, RAM = TRUE, AOM = TRUE, limDataCorr = TRUE, attBinary = 1 )
genMat( sumMenu, sumMsize, pref_list = NULL, RAM = TRUE, AOM = TRUE, limDataCorr = TRUE, attBinary = 1 )
sumMenu |
Numeric matrix, summary of choice problems, returned by |
sumMsize |
Numeric matrix, summary of choice problem sizes, returned by |
pref_list |
Numeric matrix, each row corresponds to one preference. For example, |
RAM |
Boolean, whether the restrictions implied by the random attention model of
Cattaneo, Ma, Masatlioglu, and Suleymanov (2020) should be incorporated, that is, their monotonic attention assumption (default is |
AOM |
Boolean, whether the restrictions implied by the attention overload model of
Cattaneo, Cheung, Ma, and Masatlioglu (2021) 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 |
R |
Matrices of constraints, stacked vertically. |
ConstN |
The number of constraints for each preference, used to extract from |
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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) # Generate summary statistics summaryStats <- sumData(ramdata$menu, ramdata$choice) # Generate constraint matrices constraints <- genMat(summaryStats$sumMenu, summaryStats$sumMsize) constraints$ConstN constraints$R[1:10, 1:10]
# Load data data(ramdata) # Generate summary statistics summaryStats <- sumData(ramdata$menu, ramdata$choice) # Generate constraint matrices constraints <- genMat(summaryStats$sumMenu, summaryStats$sumMsize) constraints$ConstN constraints$R[1:10, 1:10]
logitAtte
computes choice probabilities and attention frequencies for the logit attention rule
considered by Brady and Rehbeck (2016). To be specific, for a choice problem S
and its subset T
, the attention that T
attracts is assumed to be proportional to its size: |T|^a
, where a
is a parameter that one can specify. It will be assumed that
the first alternative is the most preferred, and that the last alternative is the least preferred.
This function is useful for replicating the simulation results in Cattaneo, Ma, Masatlioglu, and Suleymanov (2020), and Cattaneo, Cheung, Ma, and Masatlioglu (2022).
logitAtte(mSize = NULL, a = NULL)
logitAtte(mSize = NULL, a = NULL)
mSize |
Positive integer, size of the choice problem. |
a |
Numeric, the parameter of the logit attention rule. |
choiceProb |
The vector of choice probabilities. |
atteFreq |
The attention frequency. |
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
R. L. Brady and J. Rehbeck (2016). Menu-Dependent Stochastic Feasibility. Econometrica 84(3): 1203-1223. doi:10.3982/ECTA12694
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.
logitAtte(mSize = 5, a = 2)
logitAtte(mSize = 5, a = 2)
logitSimu
simulates choice data according to the logit attention rule
considered by Brady and Rehbeck (2016). To be specific, for a choice problem S
and its subset T
, the attention that T
attracts is assumed to be proportional to its size: |T|^a
, where a
is a parameter that one can specify. It will be assumed that
the first alternative is the most preferred, and that the last alternative is the least preferred.
This function is useful for replicating the simulation results in Cattaneo, Ma, Masatlioglu, and Suleymanov (2020), and Cattaneo, Cheung, Ma, and Masatlioglu (2022).
logitSimu(n, uSize, mSize, a)
logitSimu(n, uSize, mSize, a)
n |
Positive integer, the effective sample size for each choice problem. |
uSize |
Positive integer, total number of alternatives. |
mSize |
Positive integer, size of the choice problem. |
a |
Numeric, the parameter of the logit attention rule. |
menu |
The choice problems. |
choice |
The simulated choices. |
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
R. L. Brady and J. Rehbeck (2016). Menu-Dependent Stochastic Feasibility. Econometrica 84(3): 1203-1223. doi:10.3982/ECTA12694
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.
set.seed(42) logitSimu(n = 5, uSize = 6, mSize = 5, a = 2)
set.seed(42) logitSimu(n = 5, uSize = 6, mSize = 5, a = 2)
The file contains a standard choice data of 9,000 observations. There are five alternatives in the grand set.
See revealPref
for revealed preference analysis, and revealAtte
for revealed attention. sumData
is a low-level function that computes summary
statistics, and genMat
generates constraint matrices subject to given preferences.
Numeric matrix of 0s and 1s, choice problems (1 indicates an alternative in the choice problem and 0 otherwise).
Numeric matrix of 0s and 1s, choices (1 indicates an alternative being chosen).
This has been replaced by revealPref
.
rAtte( 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 )
rAtte( 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. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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.
Given a random sample of choice problems and choices, revealAtte
returns the upper and lower bounds on the attention frequency following the construction
of Cattaneo, Cheung, Ma, and Masatlioglu (2024).
sumData
is a low-level function that generates summary statistics. For
revealed preference analysis, see revealPref
.
revealAtte( menu, choice, alternative = NULL, S = NULL, lower = TRUE, upper = TRUE, pref = NULL, nCritSimu = 2000, level = 0.95 )
revealAtte( menu, choice, alternative = NULL, S = NULL, lower = TRUE, upper = TRUE, pref = NULL, nCritSimu = 2000, level = 0.95 )
menu |
Numeric matrix of 0s and 1s, the collection of choice problems. |
choice |
Numeric matrix of 0s and 1s, the collection of choices. |
alternative |
Numeric vector, the alternatives for which to compute bounds on the
attention frequency. For example, |
S |
Numeric matrix of 0s and 1s, the collection of choice problems to compute bounds on the attention frequency. |
lower |
Boolean, whether lower bounds should be computed (default is |
upper |
Boolean, whether upper bounds should be computed (default is |
pref |
Numeric vector, corresponding to the preference. For example, |
nCritSimu |
Integer, number of simulations used to construct the critical value. Default is |
level |
Numeric, the significance level (default is |
sumStats |
Summary statistics, generated by |
lowerBound |
Matrix containing the lower bounds. |
upperBound |
Matrix containing the upper bounds. |
critVal |
The simulated critical value. |
opt |
Options used in the function call. |
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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 (2024). Attention Overload. Working paper.
# Load data data(ramdata) # Set seed, to replicate simulated critical values set.seed(42) # preference pref <- matrix(c(1, 2, 3, 4, 5), ncol=5, byrow=TRUE) # list of choice problems S <- matrix(c(1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1), ncol=5, byrow=TRUE) result <- revealAtte(menu = ramdata$menu, choice = ramdata$choice, alternative = c(1,2), S = S, lower = TRUE, upper = TRUE, pref = pref) summary(result)
# Load data data(ramdata) # Set seed, to replicate simulated critical values set.seed(42) # preference pref <- matrix(c(1, 2, 3, 4, 5), ncol=5, byrow=TRUE) # list of choice problems S <- matrix(c(1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1), ncol=5, byrow=TRUE) result <- revealAtte(menu = ramdata$menu, choice = ramdata$choice, alternative = c(1,2), S = S, lower = TRUE, upper = TRUE, pref = pref) summary(result)
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 )
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. (2024) 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. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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 (2024). 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)
# 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)
Given a collection of choice problems and corresponding
choice probabilities, revealPrefModel
determines if they are compatible with
the Random Attention Model (RAM) of
Cattaneo, Ma, Masatlioglu, and Suleymanov (2020)
and/or the Attention Overload Model (AOM) of
Cattaneo, Cheung, Ma, and Masatlioglu (2024).
See revealPref
for revealed preference analysis with empirical choice data.
revealPrefModel( menu, prob, pref_list = NULL, RAM = TRUE, AOM = TRUE, limDataCorr = TRUE, attBinary = 1 )
revealPrefModel( menu, prob, pref_list = NULL, RAM = TRUE, AOM = TRUE, limDataCorr = TRUE, attBinary = 1 )
menu |
Numeric matrix of 0s and 1s, the collection of choice problems. |
prob |
Numeric matrix, the collection of choice probabilities |
pref_list |
Numeric matrix, each row corresponds to one preference. For example, |
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. (2024) 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 |
constraints |
Matrices of constraints, generated by |
inequalities |
The moment inequalities. Positive numbers indicate that the RAM/AOM restrictions are rejected by the given choice probabilities. |
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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 (2024). Attention Overload. Working paper.
# Logit attention with parameter 2 # True preference: 1 2 3 4 5 6 menu <- prob <- matrix(c(1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0), ncol=6, byrow=TRUE) for (i in 1:nrow(prob)) prob[i, menu[i, ]==1] <- logitAtte(sum(menu[i, ]), 2)$choiceProb # List of preferences to be tested pref_list <- matrix(c(1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 1), ncol=6, byrow=TRUE) # RAM only result1 <- revealPrefModel(menu = menu, prob = prob, pref_list = pref_list, RAM = TRUE, AOM = FALSE) summary(result1) # AOM only result2 <- revealPrefModel(menu = menu, prob = prob, pref_list = pref_list, RAM = FALSE, AOM = TRUE) summary(result2) # Both RAM and AOM result3 <- revealPrefModel(menu = menu, prob = prob, pref_list = pref_list, RAM = TRUE, AOM = TRUE) summary(result3)
# Logit attention with parameter 2 # True preference: 1 2 3 4 5 6 menu <- prob <- matrix(c(1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0), ncol=6, byrow=TRUE) for (i in 1:nrow(prob)) prob[i, menu[i, ]==1] <- logitAtte(sum(menu[i, ]), 2)$choiceProb # List of preferences to be tested pref_list <- matrix(c(1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 1), ncol=6, byrow=TRUE) # RAM only result1 <- revealPrefModel(menu = menu, prob = prob, pref_list = pref_list, RAM = TRUE, AOM = FALSE) summary(result1) # AOM only result2 <- revealPrefModel(menu = menu, prob = prob, pref_list = pref_list, RAM = FALSE, AOM = TRUE) summary(result2) # Both RAM and AOM result3 <- revealPrefModel(menu = menu, prob = prob, pref_list = pref_list, RAM = TRUE, AOM = TRUE) summary(result3)
sumData
generates summary statistics. Given a collection of
choice problems and corresponding choices, sumData
calculates the
number of occurrences of each choice problem, as well as the empirical choice
probabilities.
This function is embedded in revealPref
.
sumData(menu, choice)
sumData(menu, choice)
menu |
Numeric matrix of 0s and 1s, the collection of choice problems. |
choice |
Numeric matrix of 0s and 1s, the collection of choices. |
sumMenu |
Summary of choice problems, with repetitions removed. |
sumProb |
Estimated choice probabilities as sample averages for different choice problems. |
sumN |
Effective sample size for each choice problem. |
sumMsize |
Size of each choice problem. |
sumProbVec |
Estimated choice probabilities as sample averages, collapsed into a column vector. |
Sigma |
Estimated variance-covariance matrix for the choice rule, scaled by relative sample sizes. |
Matias D. Cattaneo, Princeton University. [email protected].
Paul Cheung, University of Maryland. [email protected]
Xinwei Ma (maintainer), University of California San Diego. [email protected]
Yusufcan Masatlioglu, University of Maryland. [email protected]
Elchin Suleymanov, Purdue University. [email protected]
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 (2024). Attention Overload. Working paper.
# Load data data(ramdata) # Generate summary statistics summaryStats <- sumData(ramdata$menu, ramdata$choice) nrow(summaryStats$sumMenu) min(summaryStats$sumN) summaryStats$sumMenu[1, ] summaryStats$sumProb[1, ] summaryStats$sumN[1]
# Load data data(ramdata) # Generate summary statistics summaryStats <- sumData(ramdata$menu, ramdata$choice) nrow(summaryStats$sumMenu) min(summaryStats$sumN) summaryStats$sumMenu[1, ] summaryStats$sumProb[1, ] summaryStats$sumN[1]