\HeaderA{predict.cggd}{Make predictions or extract coefficients from a fitted cggd model}{predict.cggd}
\keyword{regression}{predict.cggd}
\keyword{methods}{predict.cggd}
\begin{Description}\relax
While \code{cggd} produces the entire path of solutions, predict.cggd
allows one to extract a prediction at a particular point along the path.
\end{Description}
\begin{Usage}
\begin{verbatim}
 ## S3 method for class 'cggd':
 predict(object, newx, t, type = c("fit", "coefficients"), mode=c("k","t"), ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] A fitted cggd object

\item[\code{newx}] If type="fit", then newx should be the x values at which the fit is
required. If type="coefficients", then newx can be omitted.

\item[\code{t}] A value specifying the desired model. Its values depends on the mode argument. By
default (mode="k"), \emph{t} should take on values between 0 and max k (e.g.,
a step of 1.3 means .3 of the way between step 1 and 2.)

\item[\code{type}] If type="fit", predict returns the fitted value. If
type="coefficients", predict returns the coefficients.

\item[\code{mode}] Mode="k" means the t= argument indexes the cggd step number, and
the coefficients will be returned corresponding to the values
at step t. If mode="t", then t is a time on the coefficient path.

\item[\code{...}] additional parameters.

\end{ldescription}
\end{Arguments}
\begin{Value}
Either the fitted value, or a vector of coefficients.
\end{Value}
\begin{Author}\relax
Cun-Hui Zhang and Ofer Melnik
\end{Author}
\begin{References}\relax
Cun-Hui Zhang (2007) "Continuous Generalized Gradient Descent" \emph{Journal of Computational and Graphical Statistics}
; see also \url{http://stat.rutgers.edu/~cunhui/software/CGGD.html}.
\end{References}
\begin{SeeAlso}\relax
plot,  cggd, cv.cggd
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(housing)
attach(housing)
object <- cggd(x,y)
coef4.1 <- predict(object, t=4.1,type="coefficients", mode="k") 
detach(housing)
\end{ExampleCode}
\end{Examples}

