The cpLower function computes a Crawford-Pendakur type lower bound on the number of GARP-consistent subpopulations by creating a set of pairwise GARP-violating observations.
cpLower(x, p, times= 1, afriat.par= 1)
# S3 method for lowerBound
print(x, ...)
# S3 method for lowerBound
summary(object, ...)data frame or matrix containing the observed quantities, where each row corresponds to an observation and the columns are types of goods, or an object of class lowerBound to be used with print,
data frame or matrix (of same dimensions as x) containing the corresponding prices,
number of times the algorithm is run (the final result is the best of times results, ie. highest number of clusters found),
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,
object of class lowerBound as returned by cpLower,
additional arguments passed to the print and summary methods (unused).
cpLower returns an object of class lowerBound which contains the following elements:
violatorsnumeric vector containing the indices of observations that are pairwise GARP-inconsistent,
n.clustlower bound on the number of types,
hist.n.typesnumeric vector containing the history of numbers of types found during multiple runs of the algorithm.
n.typeslower bound on the number of types,
afriat.parAfriat parameter used in the algorithm.
For each run of the algorithm, a random permutation of the observations is drawn, and one by one each observation is pairwise-tested against all previously found violators. If the current observation is found pairwise-inconsistent with all previously found violators it is added to the set of violators.
Crawford, I. and Pendakur, K. (2013). How many types are there? The Economic Journal, 123(567):77-95.
See cpUpper for the upper bound on the number of types.
# NOT RUN {
# Lower bound for GARP-violating data:
data(noGarp)
cp.low <- cpLower(noGarp$x, noGarp$p)
cp.low
cp.low$violators
# }
Run the code above in your browser using DataLab