\begin{Schunk}
\begin{Sinput}
 library(mda)
 mymars2 <- mars(x,y, degree=1, nk=6) 
 summary(mymars2)
\end{Sinput}
\begin{Soutput}
               Length Class  Mode   
call             5    -none- call   
all.terms        4    -none- numeric
selected.terms   4    -none- numeric
penalty          1    -none- numeric
degree           1    -none- numeric
nk               1    -none- numeric
thresh           1    -none- numeric
gcv              1    -none- numeric
factor           5    -none- numeric
cuts             5    -none- numeric
residuals      100    -none- numeric
fitted.values  100    -none- numeric
lenb             1    -none- numeric
coefficients     4    -none- numeric
x              400    -none- numeric
\end{Soutput}
\begin{Sinput}
 mymars2$gcv 
\end{Sinput}
\begin{Soutput}
[1] 5.364216
\end{Soutput}
\begin{Sinput}
 mymars2$cuts
\end{Sinput}
\begin{Soutput}
         [,1]
[1,] 0.000000
[2,] 4.103396
[3,] 4.103396
[4,] 8.338125
[5,] 8.338125
\end{Soutput}
\begin{Sinput}
 mydf <- data.frame(x,y,fitted=mymars2$fitted)
 mydf <- mydf[order(mydf$x),]
 plot(x,y,main="Linear splines: mars output nk=6", pch=16)
 lines(mydf$x,mydf$fitted)
 rm(mymars2, mydf)
 detach("package:mda")
\end{Sinput}
\end{Schunk}
