## Use the method on a simulated data set
set.seed(79)
n <- 100; p <- 50
## Simulate design matrix and response
x <- matrix(runif(n * p, min = -2.5, max = 2.5), nrow = n, ncol = p)
y <- scale(3 * (x[,1]< 0), scale=FALSE) + x[,2]^3 + rnorm(n)
## Try lambda = 2, lambda = 1
fits <- liso.backfit(x,y, c(2,1), monotone=c(-1,rep(1, 49)))
## plot the result for lambda = 2
plot(fits[[2]])
## Plot y-yhat plot
plot(y,fits[[2]] * x)
Run the code above in your browser using DataLab