Diagnostics in Spline Regression In linear models, we do statistical tests (e.g. normality of residuals, homoskedasticity, autocorrelation, etc.). In spline regression, using the following method, we are running linear regression only. But they are not a single regression equation, but more than 1 equation.
library(splines)
   
x <- runif(100)
y <- sin(2*pi*x) + rnorm(100, 0, 0.3)

xx <- seq(0, 1, 0.01)

fit1 <- lm(y ~ bs(x, degree=1, df=4))

plot(x, y, pch=19)
lines(xx, predict(fit1, newdata=list(x=xx)), col='red')

So, my question is, do we use the same set of statistical tests in this case as well? If not, what are different test we can use?
 A: A linear model with splines is still a linear model, the change is that the splined variable is split into multiple parts/variables (piecewise terms, depends on the number of knots and what type of spline you select). To see what exactly is going on check the model matrix
> round(head(model.matrix(y ~ bs(x, degree=1, df=4)),5),2)
  (Intercept) bs(x, degree = 1, df = 4)1 bs(x, degree = 1, df = 4)2 bs(x, degree = 1, df = 4)3
1           1                       0.00                       0.00                       0.23
2           1                       0.00                       0.22                       0.78
3           1                       0.41                       0.00                       0.00
4           1                       0.00                       0.07                       0.93
5           1                       0.00                       0.00                       0.00
  bs(x, degree = 1, df = 4)4
1                       0.77
2                       0.00
3                       0.00
4                       0.00
5                       1.00

As you can see the x variable has been split into 4 new variables (depends also on the intercept argument in bs). All the regular diagnostics and tests apply here as well, although the tests are now on piecewise terms.
