notablyDistant {yaImpute} | R Documentation |
Notably distant targets are those with relatively large distances from the closest reference observation. A suitable threshold is used to detect large distances.
notablyDistant(object,kth=1,threshold=NULL,p=0.01)
object |
an object of class yai . |
kth |
the kth neighbor is used. |
threshold |
the thereshold distance that identifies notably large distances between observations. |
p |
the percentile point in the distribution of distances used to compute the threshold (only used when threshold is NULL). |
When threshold
is NULL, the function computes one by assuming
the distances follow the lognormal distribution, unless the method used
to find neighbors is randomForest
, in which case the distances
are assumed to follow the beta distribution. A specified p
value
is used to compute the threshold
.
List of two data frames that contain 1) the references that are notably distant from other references, 2) the targets that are notably distant from the references, and 3) the threshold used.
Nicholas L. Crookston ncrookston@fs.fed.us
Andrew O. Finley finleya@msu.edu
data(iris) # form some test data refs=sample(rownames(iris),50) x <- iris[,1:3] # Sepal.Length Sepal.Width Petal.Length y <- iris[refs,4:5] # Petal.Width Species # build an msn run, first build dummy variables for species. sp1 <- as.integer(iris$Species=="setosa") sp2 <- as.integer(iris$Species=="versicolor") y2 <- data.frame(cbind(iris[,4],sp1,sp2),row.names=rownames(iris)) y2 <- y2[refs,] names(y2) <- c("Petal.Width","Sp1","Sp2") msn <- yai(x=x,y=y2,method="msn") notablyDistant(msn)