grmsd (generalized root mean square distance)
as variables are added to (method="addVars") or removed from
(method="delVars") an k-NN imputation model. When adding variables
the function keeps variables that strengthen imputation and
deletes that weaken the imputation the least.
The measure of model strength is distance between
imputed and observed Y-variables.varSelection(x,y,method="addVars",yaiMethod="msn",wts=NULL,nboot=20,trace=FALSE,
useParallel=if (.Platform$OS.type == "windows") FALSE else TRUE,...)yai.yai.addVars, the X-Varialbes are added and
if delVars they are deleted (see details).method to yai.wts to grmsd
which is used to score the alternative varialbe sets.TRUE information at each step is output.link{parallel:mclapply} from link{lapply} is used (which is the only option
on windows).link{yai}varSel with these tags:method.grmsd) when variables are added or deleted one at a time.
When adding variables, the function starts with none, and keeps the single
variable that provides the smallest grmsd. When deleting variables,
the functions starts with all X-Variables and deletes them one at a
time such that those that remain provide the smallest
grmsd. The function uses the following steps:
yaiis run for all the Y-variables and candidate
X-variable(s). The result is passed toimpute.yaito get imputed
values of Y-variables. That result is passed togrmsdto compute a
mean Mahalanobis distance for the case where the candidate variable is included
(or deleted depending onmethod). However, these steps are done once
for each bootstrap replication and the resulting values are averaged to provide
an average mean Mahalanobis distance over the bootstraps.grmsdvalues, one corresponding to the case where each candidate
is added or deleted.method="addVars"), the variable that
is related to the smallestgrmsdis kept. When variables are being
deleted (method="delVars"), the variable that
is related to the largestgrmsdis deleted.yai, impute.yai, bestVars and
grmsddata(iris)
set.seed(12345)
x <- iris[,1:2] # Sepal.Length Sepal.Width
y <- iris[,3:4] # Petal.Length Petal.Width
vsel <- varSelection(x=x,y=y,nboot=5,useParallel=FALSE)
vsel
bestVars(vsel)
plot(vsel)Run the code above in your browser using DataLab