knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

Travis build status AppVeyor build status Coverage status CRAN status lifecycle

missTune

This package is an alternative implementation of the missForest and missRanger packages using tuned Random Forests. The tuneRF function from the randomForest is used internally to find the optimal mtry parameter.

Installation

You can install the development version from Github with:

# install.packages("devtools")
devtools::install_github("kvantas/missTune")

Example

This is a basic example about infilling a dataset.

library(missTune)
# create random na values
iris_na <- generate_na(iris, p = 0.1, seed = 123)

# infill values
res_imp <- miss_tune(x_miss = iris_na, num_trees = 100, verbose = TRUE)

Let's view the original data-set with the missing values and the infilled one.

head(iris_na)
head(res_imp$x_imp)

And finally let's create a plot with the mean out of bag error during the iterations of the algorithm.

library(ggplot2)
mean_errors <- unlist(lapply(res_imp$oob_list, mean))
ggplot()+
  geom_line(aes(x = 1: length(mean_errors), mean_errors)) +
  scale_x_continuous(breaks = 1: length(mean_errors)) + 
  xlab("Iteration") + ylab("Error")+
  theme_bw()

Meta

Please note that the missTune project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



kvantas/missTune documentation built on May 12, 2019, 10:51 a.m.