A symbolic routine to define that the systematic component *η* is decreasing and convex in a predictor in a formula argument to cgam. This is the unsmoothed version.

1 |

`x` |
A numeric predictor which has the same length as the response vector. |

`numknots` |
The number of knots used to smoothly constrain a predictor. The value should be |

`knots` |
The knots used to smoothly constrain a predictor. The value should be |

`space` |
A character specifying the method to create knots. It will not be used for a shape-restricted predictor without smoothing. The default value is "E". |

"decr.conv" returns the vector "x" and imposes on it five attributes: name, shape, numknots, knots and space.

The name attribute is used in the subroutine plotpersp; the numknots, knots and space attributes are the same as the numknots, knots and space arguments in "decr.conv"; the shape attribute is 6("decreasing and convex"), and according to the value of the vector itself and its shape attribute, the cone edges of the cone generated by the constraint matrix, which constrains the relationship between the systematic component *η* and "x" to be decreasing and convex, will be made. The cone edges are a set of basis employed in the hinge algorithm.

Note that "decr.conv" does not make the corresponding cone edges itself. It sets things up to a subroutine called makedelta in cgam.

See references cited in this section for more details.

The vector x with five attributes, i.e., nm: the name of x; shape: 6 ("decreasing and convex"); numknots: the numknots argument in "decr.conv"; knots: the knots argument in "decr.conv"; space: the space argument in "decr.conv".

Mary C. Meyer and Xiyue Liao

Meyer, M. C. (2013b) A simple new algorithm for quadratic programming with applications in statistics. *Communications in Statistics 42(5)*, 1126–1139.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
data(cubic)
# extract x
x <- - cubic$x
# extract y
y <- cubic$y
# regress y on x with the shape restriction: "decreasing" and "convex"
ans <- cgam(y ~ decr.conv(x))
# make a plot
par(mar = c(4, 4, 1, 1))
plot(x, y, cex = .7, xlab = "x", ylab = "y")
lines(x, ans$muhat, col = 2)
legend("bottomright", bty = "n", "decreasing and convex fit", col = 2, lty = 1)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.