\begin{Schunk}
\begin{Sinput}
 mymod4 <- lm(y ~ rcs(x, 10))
 predict4 <- predict(mymod4, newdata = data.frame(x = newx))
 plot(x, y, main = "10 Knots! Using lm(y~rcs(x,10))", pch = 16)
 lines(newx, predict4)
\end{Sinput}
\end{Schunk}
