na.roughfix: Rough Imputation of Missing Values

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Impute Missing Values by median/mode.

Usage

1
na.roughfix(object, ...)

Arguments

object

a data frame or numeric matrix.

...

further arguments special methods could require.

Value

A completed data matrix or data frame. For numeric variables, NAs are replaced with column medians. For factor variables, NAs are replaced with the most frequent levels (breaking ties at random). If object contains no NAs, it is returned unaltered.

Note

This is used as a starting point for imputing missing values by snpRF. However as noted in snpRFImpute, only the covariates can be imputed, since genetic data should be imputed using software specifically designed for SNP imputation.

Author(s)

Andy Liaw (copied from randomForest package by Greg Jenkins)

See Also

snpRFImpute, snpRF.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(snpRFexample)
covar.na <- covariates
set.seed(111)
## artificially drop some data values.
for (i in 1:2) covar.na[sample(200, sample(20)), i] <- NA
eg.roughfix <- na.roughfix(covar.na)
eg.narf <- snpRF(x.autosome=autosome.snps,x.xchrom=xchrom.snps,
                 xchrom.names=xchrom.snps.names,x.covar=eg.roughfix,
                 y=phenotype)
print(eg.narf)

Example output

snpRF 0.4

Call:
 snpRF(x.autosome = autosome.snps, x.xchrom = xchrom.snps, xchrom.names = xchrom.snps.names,      x.covar = eg.roughfix, y = phenotype) 
               Type of random forest: classification
                     Number of trees: 500
No. of variables tried at each split: 5

        OOB estimate of  error rate: 48.5%
Confusion matrix:
        control case class.error
control      30   62   0.6739130
case         35   73   0.3240741

snpRF documentation built on May 2, 2019, 6:51 a.m.

Related to na.roughfix in snpRF...