when NULL (and method="kth"),
the best pick is reported (a reference observation represents itself),
otherwise the kth neighbor is picked.
method
the method used to select references to represent observations,
as follows: kth: the kth nearest neighbor is picked; random: for each observation, the value of kth is selected at
random from the 1 to k neighbors (1 to kth if is kth
specified); randomWeighted: 1/(1+d) is used as a probability weight factor
in selecting the value of kth, where d is the distance..
targetsOnly
when is TRUE, reporting of references is not done.
require(yaImpute)
data(iris)
# form some test data
set.seed(1234)
refs=sample(rownames(iris),50)
x <- iris[,1:3] # Sepal.Length Sepal.Width Petal.Length
y <- iris[refs,4:5] # Petal.Width Species
# build a yai object using mahalanobis
mal <- yai(x=x,y=y,method="mahalanobis",k=3)
foruse(mal) # for references, use is equal to the rowname
foruse(mal,kth=1) # for references, use is an row to the kth reference.
# get all the choices:
cbind(foruse(mal),foruse(mal,kth=1),foruse(mal,kth=2),foruse(mal,kth=3))