I have points in the x-y-plane that are strictly increasing most of the time. The problem is that there are cases with one or two outliers (Knots where an out-of-the-box spline would be decreasing). Without deleting any data points, is there a way to interpolate / create a spline that is strictly increasing everywhere? Also, I would like the interpolation to be $C^1$. (Which package could do this in R?)
cobs allows you to fit shape-constrained splines, including monotonically increasing ones; syntax would be something like:
require(cobs) fit = cobs(x,y, constraint= "increase", lambda=0, degree=1, # for L1 roughness knots=seq(min(x),max(x),length.out=10), # desired nr of knots tau=0.5) # to predict median preds = predict(fit,interval="none",z=xvals)[,2]
And R packages ConSpline, scar, scam and cgam offer also alternative options to fit shape-constrained splines, including monotonically increasing ones....