Description Usage Arguments Details Value References Examples

Fits boundary of data with kernel smoothing, imposing monotonicity and/or concavity constraints.

1 2 3 |

`X.eval` |
Matrix of inputs used for fitting |

`y.eval` |
Vector of outputs used for fitting |

`X.bounded` |
Matrix of inputs where bounding constraints apply |

`y.bounded` |
Vector of outputs where bounding constraints apply |

`X.constrained` |
Matrix of inputs where monotonicity/concavity constraints apply |

`X.fit` |
Matrix of inputs where curve is fit; defaults to X.constrained |

`y.fit.observed` |
Vector of outputs corresponding to observations in X.fit; used for efficiency calculation |

`H.inv` |
Inverse of the smoothing matrix (must be positive definite); defaults to rule of thumb |

`H.mult` |
Scaling factor for rule of thumb smoothing matrix |

`method` |
Constraints to apply; "u" for unconstrained, "m" for monotonically increasing, and "mc" for monotonically increasing and concave |

`scale.constraints` |
Boolean, whether to scale constraints by their average value, can help with convergence |

This method fits a smooth boundary of the data (with all data points below the boundary) while imposing specified monotonicity and concavity constraints. The procedure is derived from Racine et al. (2009), which develops kernel smoothing methods with bounding, monotonicity and concavity constraints. Specifically, the smoothing procedure involves finding optimal weights for a Nadaraya-Watson estimator of the form

*\hat{y} = m(x) = ∑_{i=1}^N p_i A(x, x_i) y_i,*

where *x* are inputs, *y* are outputs, *p* are weights, subscripts
index observations, and

*A(x, x_i) = \frac{K(x, x_i)}{∑_{h=1}^N K(x, x_h)}*

for a kernel *K*. This method uses a multivariate normal kernel of the form

*K(x, x_h) = \exp≤ft(-\frac12 (x - x_h)'H^{-1}(x - x_h)\right),*

where *H* is a bandwidth matrix. Bandwidth selection is performed via Silverman's
(1986) rule-of-thumb, in the function `H.inv.select`

.

Optimal weights *\hat{p}* are selected by solving the quadratic programming problem

*\min_p \mbox{\ \ }-\mathbf{1}'p + \frac12 p'p.*

This method always imposes bounding constraints as specified points, given by

*m(x_i) - y_i = ∑_{h=1}^N p_h A(x_i, x_h) y_h - y_i ≥q 0 \mbox{\ \ \ \ }\forall i.*

Additionally, monotonicity constraints of the following form can be imposed at specified points:

*\frac{\partial m(x)}{\partial x^j} = ∑_{h=1}^N p_h \frac{\partial A(x, x_h)}{\partial x^j} y_h ≥q 0 \mbox{\ \ \ \ }\forall x, j,*

where superscripts index inputs. Finally concavity constraints of the following form can also be imposed using Afriat's (1967) conditions:

*m(x) - m(z) ≤q \nabla_x m(z) \cdot (x - z) \mbox{\ \ \ \ }\forall x, z.*

The gradient of the frontier at a point *x* is given by

*\nabla_x m(x) = ∑_{i=1}^N \hat{p}_i \nabla_x A(x, x_i) y_i,*

where *\hat{p}_i* are estimated weights.

Returns a list with the following elements

`y.fit` |
Estimated value of the frontier at X.fit |

`gradient.fit` |
Estimated gradient of the frontier at X.fit |

`efficiency` |
Estimated efficiencies of y.fit.observed |

`solution` |
Boolean; TRUE if frontier successfully estimated |

`X.eval` |
Matrix of inputs used for fitting |

`X.constrained` |
Matrix of inputs where monotonicity/concavity constraints apply |

`X.fit` |
Matrix of inputs where curve is fit |

`H.inv` |
Inverse smoothing matrix used in fitting |

`method` |
Method used to fit frontier |

`scaling.factor` |
Factor by which constraints are multiplied before quadratic programming |

ParmeterRacinesnfa

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ```
data(univariate)
#Set up data for fitting
X <- as.matrix(univariate$x)
y <- univariate$y
N.fit <- 100
X.fit <- as.matrix(seq(min(X), max(X), length.out = N.fit))
#Reflect data for fitting
reflected.data <- reflect.data(X, y)
X.eval <- reflected.data$X
y.eval <- reflected.data$y
#Fit frontiers
frontier.u <- fit.boundary(X.eval, y.eval,
X.bounded = X, y.bounded = y,
X.constrained = X.fit,
X.fit = X.fit,
method = "u")
frontier.m <- fit.boundary(X.eval, y.eval,
X.bounded = X, y.bounded = y,
X.constrained = X.fit,
X.fit = X.fit,
method = "m")
frontier.mc <- fit.boundary(X.eval, y.eval,
X.bounded = X, y.bounded = y,
X.constrained = X.fit,
X.fit = X.fit,
method = "mc")
#Plot frontier
library(ggplot2)
frontier.df <- data.frame(X = rep(X.fit, times = 3),
y = c(frontier.u$y.fit, frontier.m$y.fit, frontier.mc$y.fit),
model = rep(c("u", "m", "mc"), each = N.fit))
ggplot(univariate, aes(X, y)) +
geom_point() +
geom_line(data = frontier.df, aes(color = model))
#Plot slopes
slope.df <- data.frame(X = rep(X.fit, times = 3),
slope = c(frontier.u$gradient.fit,
frontier.m$gradient.fit,
frontier.mc$gradient.fit),
model = rep(c("u", "m", "mc"), each = N.fit))
ggplot(slope.df, aes(X, slope)) +
geom_line(aes(color = model))
``` |

```
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.