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