Tuning parameter k in function alts using Bayesian Information Criterion (BIC) with some adjustment.
Useful links