wps(formula, family = gaussian(), data = NULL, weights = NULL, pnt = FALSE,
pen = 0, cpar = 1.5)
The surface and covariate effects are estimated simultaneously with a single cone projection (no back-fitting). See references cited in this section and the official manual(
A penalized spline version is also provided. Over each knot rectangle, the regression surface is a warped plane, and the slopes can change abruptly from one rectangle to the next. To obtain smoother fits, and to side-step the problem of knot choices, we can use large number of knots for both predictors and penalize these changes in slopes. The size of the penalty parameter will control the effective degrees of freedom of the fit. In practice, the penalty term can be chosen through generalized cross-validation, similar to the method in Meyer (2012).
Meyer, M. C. (2012) Constrained penalized splines. Canadian Journal of Statistics 40(1), 190--206.
Meyer, M. C. (2016) Estimation and inference for isotonic regression in two dimensions, using warped-plane splines.
library(MASS)
data(Rubber)
# regress loss on hard and tens under the shape-restriction: "doubly-decreasing"
# with a penalty term equal to 1
# use 13 knots for each predictor
ans <- wps(loss ~ dd(hard, tens, numknots = c(13, 13)), data = Rubber, pen = 1)
# make a 3D plot of the constrained surface
plotpersp(ans, hard, tens, data = Rubber)
Run the code above in your browser using DataLab