sumData {ramchoice} | R Documentation |
Generate Summary Statistics
Description
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
.
Usage
sumData(menu, choice)
Arguments
menu |
Numeric matrix of 0s and 1s, the collection of choice problems. |
choice |
Numeric matrix of 0s and 1s, the collection of choices. |
Value
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. |
Author(s)
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
References
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.
Examples
# 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]