Monotonize a step function by rearrangement. Returns a matrix or array of points which are monotonic, or a monotonic function performing linear (or constant) interpolation.
a list or data frame, the entries of which are vectors containing the x values corresponding to the fitted y values
y
a vector, matrix, or three-dimensional array containing the fitted values of a model, typically the result of a regression
n
an integer denoting the number of sample points desired
stochastic
logical. If TRUE, stochastic sampling will be used
avg
logical. If TRUE, the average rearrangement will be computed and outputted
order
a vector containing the desired permutation of the elements of 1:length(x). The rearrangement will be performed in the order specified if avg= FALSE, otherwise all the possible orderings are computed and the average rearrangement is reported
Details
This function applies this rearrangement operator of Hardy, Littlewood, and Polya (1952) to the estimate of a monotone function.
Note: rearrangement currently only operates on univariate, bivariate, and trivariate regressions (that is, length(x)<=3).
Value
rearrangement returns a matrix or array of equivalent dimension and size to y that is monotonically increasing in all of its dimensions.
Author(s)
Wesley Graybill, Mingli Chen, Victor Chernozhukov, Ivan Fernandez-Val, Alfred Galichon
References
Chernozhukov, V., I. Fernandez-Val, and a. Galichon. 2009. Improving point and interval estimators of monotone functions by rearrangement. Biometrika 96 (3): 559-575.
Chernozhukov, V., I. Fernandez-Val, and a. Galichon. 2010. Quantile and Probability Curves Without Crossing. Econometrica 78(3): 1093-1125.
Hardy, G.H., J.E. Littlewood, and G. Polya, Inequalities,2nd ed, Cambridge U. Press,1952