\HeaderA{magic.post.proc}{Auxilliary information from magic fit}{magic.post.proc}
\keyword{models}{magic.post.proc}
\keyword{smooth}{magic.post.proc}
\keyword{regression}{magic.post.proc}
\begin{Description}\relax
Obtains Bayesian parameter covariance matrix, frequentist
parameter estimator covariance matrix, estimated degrees of 
freedom for each parameter and leading diagonal of influence/hat matrix, 
for a penalized regression estimated by \code{magic}.
\end{Description}
\begin{Usage}
\begin{verbatim}
magic.post.proc(X,object,w)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{X}] is the model matrix.
\item[\code{object}] is the list returned by \code{magic} after fitting the 
model with model matrix \code{X}.
\item[\code{w}] is the weight vector used in fitting, or the weight matrix used 
in fitting (i.e. supplied to \code{magic}, if one was.) \code{t(w)\%*\%w} should typically give
the inverse of the covariance matrix of the response data supplied to \code{magic}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{object} contains \code{rV} (\eqn{ {\bf V}}{V}, say), and 
\code{scale} (\eqn{ \phi}{s}, say) which can be 
used to obtain the require quantities as follows. The Bayesian covariance matrix of 
the parameters is \eqn{ {\bf VV}^\prime \phi}{VV's}. The vector of 
estimated degrees of freedom for each parameter is the leading diagonal of 
\eqn{ {\bf VV}^\prime {\bf X}^\prime {\bf W}^\prime {\bf W}{\bf X}}{VV'X'W'WX} 
where \eqn{\bf{W}}{W} is either the 
weight matrix \code{w} or the matrix \code{diag(w)}. The 
hat/influence  matrix is given by 
\eqn{ {\bf WX}{\bf VV}^\prime {\bf X}^\prime {\bf W}^\prime }{WXVV'X'W'}
.

The frequentist parameter estimator covariance matrix is 
\eqn{ {\bf VV}^\prime {\bf X}^\prime {\bf W}^\prime {\bf WXVV}^\prime \phi}{VV'X'W'WXVV's}: 
it is useful for testing terms for equality to zero.
\end{Details}
\begin{Value}
A list with three items:
\begin{ldescription}
\item[\code{Vb}] the Bayesian covariance matrix of the model parameters.
\item[\code{Ve}] the frequentist covariance matrix for the parameter estimators.
\item[\code{hat}] the leading diagonal of the hat (influence) matrix.
\item[\code{edf}] the array giving the estimated degrees of freedom associated 
with each parameter.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Simon N. Wood \email{simon.wood@r-project.org}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{magic}{magic}}
\end{SeeAlso}

