The function sets up a smooth term for shape constraint estimation of P-spline model terms. Note that this currently only works using boosting and backfitting.

# S3 method for ms.smooth.spec
smooth.construct(object, data, knots, ...)



Either a smooth specification object, or object of class "bamlss", "bamlss.frame", "bamlss.formula" or "bamlss.terms". For smooth specification objects, see function smooth.construct.


A data frame or list, see also see function smooth.construct.


See function smooth.construct.


Arguments passed to the smooth term constructor functions.


See function see smooth.construct.


if (FALSE) ## Generate some data.

n <- 300
x <- runif(n, -2, 3)
y <- sin(x) + rnorm(n, sd = 0.1)

## Increasing: constr = 1.
## Decreasing: constr = 2.
b <- bamlss(y ~ s2(x,bs="ms",xt=list(constr=1)),
  data = d, sampler = FALSE, optimizer = opt_bfit)
#> Error in bamlss.model.frame(formula, data, family, weights, subset, offset,     na.action, specials, contrasts): object 'd' not found

## Predict and plot.
p <- predict(b, model = "mu")
#> Error in predict(b, model = "mu"): object 'b' not found
plot(y ~ x)

plot2d(p ~ x, add = TRUE, col.lines = 4, lwd = 2)
#> Error in as.matrix(p): object 'p' not found