library(ggplot2) library(mgcv) ggplot(mtcars) + aes(x = hp, y = disp) + geom_point() + stat_smooth( aes(color = "vanilla gam"), method = "gam" ) + stat_smooth( aes(color = "monotonic constraint"), method = mgcv::scasm, formula = y ~ s(x, bs = "sc", xt = c("m+")) )

plot produced with the new scasm() model in ggplot2
1

Replies

No replies yet