# NOT RUN {
##------ Piecewise constant trend filtering example in Wen et al.(2018).-----
set.seed(1)
data <- SimuBlocks(2048)
fit <- samias(data$y, kmax = 15) # With default input argument
plot(fit, type="coef", main = "Blocks") # Plot the optimal estimate
lines(data$x, data$y0, type="s") # Add the true signal for reference
plot(fit, type= "vpath", main = "Blocks") # Plot the solution path
# }
Run the code above in your browser using DataLab