\HeaderA{fixDependence}{Detect linear dependencies of one matrix on another}{fixDependence}
\keyword{models}{fixDependence}
\keyword{regression}{fixDependence}
\begin{Description}\relax
Identifies columns of a matrix \code{X2} which are linearly
dependent on columns of a matrix \code{X1}. Primarily of use in setting up 
identifiability constraints for nested GAMs.
\end{Description}
\begin{Usage}
\begin{verbatim}
fixDependence(X1,X2,tol=.Machine$double.eps^.5)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{X1}] A matrix.
\item[\code{X2}] A matrix, the columns of which may be partially linearly
dependent on the columns of \code{X1}.
\item[\code{tol}] The tolernce to use when assessing linear dependence.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The algorithm uses a simple approach based on QR decomposition: see
code for details.
\end{Details}
\begin{Value}
An array of the columns of \code{X2} which are linearly dependent on
columns of \code{X1}. \code{NULL} if the two matrices are independent.
\end{Value}
\begin{Author}\relax
Simon N. Wood \email{simon.wood@r-project.org}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
n<-20;c1<-4;c2<-7
X1<-matrix(runif(n*c1),n,c1)
X2<-matrix(runif(n*c2),n,c2)
X2[,3]<-X1[,2]+X2[,4]*.1
X2[,5]<-X1[,1]*.2+X1[,2]*.04
fixDependence(X1,X2)
\end{ExampleCode}
\end{Examples}

