ramchoice (version 1.1)

rAtte: rAtte: Estimation and Inference in Random Attention Models

Description

Given a random sample of choice problems and choices, rAtte 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.

Usage

rAtte(menu, choice, pref_list = NULL, method = "GMS",
  nCritSimu = 2000, BARatio2MS = 0.1, BARatio2UB = 0.1,
  MNRatioGMS = NULL, limDataCorr = TRUE, attBinary = 1)

Arguments

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, c(2, 3, 1) means 2 is preferred to 3 and to 1. When set to NULL, the default, c(1, 2, 3, ...), will be used.

method

String, the method for constructing critical values. Default is GMS (generalized moment selection). Other available options are LF (least favorable model), PI (plug-in method), 2MS (two-step moment selection), 2UB (two-step moment upper bound), or ALL (report all critical values).

nCritSimu

Integer, number of simulations used to construct the critical value. Default is 2000.

BARatio2MS

Numeric, beta-to-alpha ratio for two-step moment selection method. Default is 0.1.

BARatio2UB

Numeric, beta-to-alpha ratio for two-step moment upper bound method. Default is 0.1.

MNRatioGMS

Numeric, shrinkage parameter. Default is sqrt(1/log(N)), where N is the sample size.

limDataCorr

Boolean, whether assumes limited data (default is TRUE). When set to FALSE, it will be assumed that all choice problems are observed.

attBinary

Numeric, between 1/2 and 1 (default is 1), whether additional restriction on the attention rule should be imposed for binary choice problems (i.e., attentive at binaries).

Value

sumStats

Summary statistics, generated by sumData.

constraints

Matrices of constraints, generated by genMat.

Tstat

Test statistic.

critVal

Critical values.

pVal

P-values (only available for GMS, LF and PI).

method

Method for constructing critical value.

References

M. D. Cattaneo, X. Ma, Y. Masatlioglu and E. Suleymanov (2019). A Random Attention Model. Journal of Political Economy, forthcoming.

Examples

Run this code
# NOT RUN {
# Load data
data(ramdata)

# Set seed, to replicate simulated critical values
set.seed(42)

# Inference based on the standard random attention model
result <- rAtte(menu = ramdata$menu, choice = ramdata$choice, method = "GMS",
  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))
summary(result)

# Inference employing additional restrictions for binary choice problems
result2 <- rAtte(menu = ramdata$menu, choice = ramdata$choice, method = "GMS", attBinary = 2/3,
  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))
summary(result2)

# }

Run the code above in your browser using DataCamp Workspace