Theory of spline regression with applications to time series, longitudinal, and categorical data, and data with jumps