Learn R Programming

yaImpute (version 1.0-3)

compare.yai: Compares different k-NN solutions

Description

Provides a convenient display of the root mean square differences (see rmsd.yai) or correlations (see cor.yai) between observed and imputed values for each of several imputations. Each column of the returned data frame corresponds to an imputation result and each row corresponds to a variable.

Usage

compare.yai(...,ancillaryData=NULL,vars=NULL,method="rmsd")

Arguments

...
a list of objects created by yai or impute.yai that you wish to compare.
ancillaryData
a data frame that defines new variables, passed to impute.yai.
vars
a list of variable names you want to include; if NULL all available variables are included.
method
when rmsd is specified, the comparison is based on root mean square differences between observed an imputed, and when cor is specified, the comparison is based on correlations between observed and imputed.

Value

  • A data.frame of class c("compare.yai","data.frame"), where the columns are the names of the ...-arguments and the rows are a union of variable names. NA's are returned when the variables are factors.

See Also

yai, plot.compare.yai, impute.yai, rmsd.yai

Examples

Run this code
require(yaImpute)

data(iris)

# form some test data
refs=sample(rownames(iris),50)
x <- iris[,1:2]      # Sepal.Length Sepal.Width
y <- iris[refs,3:4]  # Petal.Length Petal.Width

# build yai objects using 2 methods
msn <- yai(x=x,y=y)
mal <- yai(x=x,y=y,method="mahalanobis")

# compare the y variables
compare.yai(msn,mal)

# compare the all variables in iris
compare.yai(msn,mal,ancillaryData=iris)  # Species is a factor, no comparison is made

Run the code above in your browser using DataLab