Arguments
X
Numeric matrix of size n x p, where n is the
number is restaurants to be graded and p is the number of inspections
to be used in grade assignment. Entry X[i,j] represents the
inspection score for the ith restaurant in the jth most recent
inspection.
z
Character vector of length n representing ZIP codes (or other
subunits within a jurisdiction). z[i] is the ZIP code corresponding
to the restaurant with inspection scores in row i of X.
gamma
Numeric vector representing absolute grade cutoffs. Entries in
gamma should be increasing, with gamma[1] <= gamma[2] etc (this is
related to the "Warning" section and larger scores being associated with
higher risk).
resolve.ties
Boolean value that determines the definition of quantile
to be used after optimal quantiles have been found with the
percentileSeek function. See Modes below, as well as Appendix J of
Ho, D.E., Ashwood, Z.C., and Elias, B. "Improving the Reliability of Food
Safety Disclosure: A Quantile Adjusted Restaurant Grading System for
Seattle-King County".
restaurant.tol
An integer indicating the maximum difference in the number of
restaurants in a grading category between the unadjusted and adjusted
grading algorithms (for the top length(gamma) grading categories).
max.iterations
The maximum number of iterations that the iterative
algorithm (carried out by the internal percentileSeek function)
should run in order to find optimal quantiles for ZIP cutoffs. The iterative
algorithm is described in more detail below.
Modes
When resolve.ties = TRUE, in order to calculate
quantile cutoffs in a ZIP code, we alter the definition of quantile from
the usual "Nearest Rank" definition and use the "Quantile Adjustment (with
Ties Resolution)" definition that is discussed in Appendix J of
Ho, D.E., Ashwood, Z.C., and Elias, B. "Improving the Reliability of Food
Safety Disclosure: A Quantile Adjusted Restaurant Grading System for
Seattle-King County" (working paper). In particular, once we have found the
optimal set of quantiles to be applied across ZIP codes, p,
with the percentileSeek function, instead of returning (for B/C
cutoffs, for example) the scores in each ZIP code that result in at
least (p[2] x 100)% of restaurants in the ZIP code scoring
less than or equal to these cutoffs, the mode resolve.ties = TRUE
takes into account the ties that exist in ZIP codes. Returned scores for
A/B cutoffs are those that result in the closest percentage of
restaurants in the ZIP code scoring less than or equal to the A/B cutoff to
the desired percentage, (p[1] x 100)%. Similarly, B/C cutoffs
are the scores in the ZIP code that result in the closest percentage
of restaurants in the ZIP code scoring less than or equal to the B/C cutoff
and more than the A/B cutoff to the desired percentage, ((p[2] -
p[1]) x 100)%. When resolve.ties = FALSE, we use the usual "Nearest
Rank" definition of quantile when applying the optimal quantiles,
p, across ZIP codes.Warning
findCutoffs will produce cutoff scores even for ZIP
codes with only one restaurant: situations in which a quantile adjustment
shouldn't be used. It is the job of the user to ensure that, if using the
findCutoffs function, it makes sense to do so. This may involve only
performing the quantile adjustment on larger ZIP codes and providing
absolute cutoff points for smaller ZIP codes, or may involve aggregating
smaller ZIP codes into a larger geographical unit and then performing the
quantile adjustment on the larger area (the latter approach is the one we
adopted). As mentioned previously, findCutoffs was created for
an inspection system that associates greater risk with larger inspection
scores. If the inspection system of interest associates greater risk with
reduced scores, it will be neccessary to perform a transformation of the
scores matrix before utilizing the findCutoffs function. However a
simple function such as f(score) = - score would perform the
necessary transformation.