## Monotone increasing SCOP-spline examples with a start at zero constraint...
  ## passing through 0 at -1...
  require(scam)
  set.seed(7)
  n <- 100;
  x <- c(-1,runif(n-1)*4-1); ## starting at -1 for a function to be zero at a start
  z <- runif(n)
  y <- exp(4*x)/(1+exp(4*x)) -0.01798621+ z*(1-z)*5 + rnorm(100)*.4
  m1 <- scam(y~s(x,bs='miso')+s(z)) 
  plot(m1,pages=1)
  newd<- data.frame(x=-1,z=0)
  predict(m1,newd, type='terms')
if (FALSE) {
  ## passing through 0 at 0...
  set.seed(53)
  n <- 100;
  x <- c(0,runif(n-1)); ## starting at 0 for a function to be zero at a start
  z <- runif(n)
  y <- exp(3*x)/10-.1 + z*(1-z)*5 + rnorm(100)*.4
  m2 <- scam(y~s(x,bs='miso')+s(z)) 
  plot(m2,pages=1)
  newd<- data.frame(x=0,z=0)
  predict(m2,newd, type='terms')
    }
Run the code above in your browser using DataLab