Revision a4d717b5864005b0632730e50c7ff6f6b79fa30b authored by Matthias Templ on 06 March 2009, 17:46:31 UTC, committed by cran-robot on 06 March 2009, 17:46:31 UTC
1 parent 62ec427
impKNNa.Rd
\name{impKNNa}
\alias{impKNNa}
\title{ Imputation of missing values in compositional data using knn methods }
\description{
This function offers several knn methods for the imputation of missing values in compositional data.
}
\usage{
impKNNa(x, method = "knn", k = 3, metric = "Aitchison", agg = "median", primitive = FALSE, normknn = TRUE, das = FALSE)
}
\arguments{
\item{x}{ data frame or matrix }
\item{method}{ method (at the moment, only \dQuote{knn} can be used) }
\item{k}{ number of nearest neighbors chosen for imputation }
\item{metric}{ \dQuote{Aichison} or \dQuote{Euclidean} }
\item{agg}{ \dQuote{median} or \dQuote{mean}, for the aggregation of the nearest neighbors }
\item{primitive}{ if TRUE, a more enhanced search for the $k$-nearest neighbors is obtained (see details)}
\item{normknn}{ An adjustment of the imputed values is performed if TRUE }
\item{das}{depricated. if TRUE, the original definition of the Aitchison distance is used to calculate distances between observations.
if FALSE, a version using the clr transformation is used.}
}
\details{
The Aitchison \code{metric} should be chosen when dealing with compositional data, the Euclidean \code{metric} otherwise. \\
If \code{primitive} \eqn{==} FALSE, a sequential search for the \eqn{k}-nearest neighbors
is applied for every missing value where all information corresponding to the
non-missing cells plus the information in the variable to be imputed plus some
additional information is available. If \code{primitive} \eqn{==} TRUE, a search of the
\eqn{k}-nearest neighbors among observations is applied where in addition to the variable
to be imputed any further cells are non-missing. \\
If \code{normknn} is TRUE (prefered option) the imputed cells from a nearest neighbor method are adjusted with special adjustment factors (more details can be found online (see the references)).
}
\value{
\item{xOrig }{Original data frame or matrix}
\item{xImp }{Imputed data}
\item{w }{Amount of imputed values}
\item{wind }{Index of the missing values in the data}
\item{metric }{Metric used}
}
\references{
Hron, K. and Templ, M. and Filzmoser, P. (2008) Imputation of missing values for compositional data using classical and robust methods
\emph{Research Report SM-2008-4, Vienna University of Technology}, 15 pages.
}
\author{ Matthias Templ }
\seealso{ \code{\link{impCoda}} }
\examples{
data(aitchison395)
x <- aitchison395
x[1,3]
x[1,3] <- NA
xi <- impKNNa(x)$xImp
xi[1,3]
}
\keyword{ manip }
\keyword{ multivariate }
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...