\HeaderA{fill.missing}{Fill in missing data}{fill.missing}
\keyword{utilities}{fill.missing}
\begin{Description}\relax
This is the function to do missing data imputation.
\end{Description}
\begin{Usage}
\begin{verbatim}
fill.missing(data, method="knn", k=20, dist.method="euclidean")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{data}] An object of class \code{madata}, which should be the result
from \code{\LinkA{read.madata}{read.madata}}.
\item[\code{method}] The method to do missing data imputation. Currently only
"knn" (K nearest neighbour) is implemented.
\item[\code{k}] Number of neighbours used in imputation. Default is 20.
\item[\code{dist.method}] The distance measure to be used. See
\code{\LinkA{dist}{dist}} for detail.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function will take an object of class \code{madata} and fill in
the missing data. Currently only KNN (K nearest neighbour) algorithm
is implemented. The memory usage is quadratic in the number of genes.
\end{Details}
\begin{Value}
An object of class \code{madata} with missing data filled in.
\end{Value}
\begin{Author}\relax
Hao Wu
\end{Author}
\begin{References}\relax
\item O.Troyanskaya, M. Cantor, G. Sherlock, P. Brown, T. Hastie,
R. Tibshirani, D. Botstein, \& R. B. Altman. Missing Value estimation
methods for DNA microarrays. Bioinformatics 17(6):520-525, 2001.
\end{References}
\begin{Examples}
\begin{ExampleCode}
data(abf1)
# randomly generate some missing data 
rawdata <- abf1
ndata <- length(abf1$data)
pct.missing <- 0.05 # 5
idx.missing <- sample(ndata, floor(ndata*pct.missing))
rawdata$data[idx.missing] <- NA
rawdata <- fill.missing(rawdata)
# plot impute data versus original data
plot(rawdata$data[idx.missing], abf1$data[idx.missing])
abline(0,1)
\end{ExampleCode}
\end{Examples}

