I tried to use cross validation to find the optimal degrees of freedom for bs().
cv.error= rep (0 ,7) for (i in 4:10) { lm.fit=lm(nox~bs(dis, df=i),data = B