Last chance! 50% off unlimited learning
Sale ends in
# NOT RUN {
# generate data
n <- 200
set.seed(123)
x1 <- runif(n); x2 <- runif(n)
y <- (x1 - 1)^2 + (x2 - 3)^2 + rnorm(n)
# regress y on x1 and x2 under the shape-restriction: "doubly-convex"
ans <- cgam(y ~ s.conv.conv(x1, x2), nsim = 0)
# make a 3D plot of the constrained surface
plotpersp(ans)
# }
Run the code above in your browser using DataLab