R/imp_plot_convergence.R

#' @title
#'
#' @description imp_plot_convergence()
#'
#' @param
#'
#' @param
#'
#' @return
#'
#' @note
#'
#' @author Antonio J Berlanga-Taylor, George Adams, Deborah Schneider-Luftman <\url{https://github.com/EpiCompBio/bigimp}>
#'
#' @seealso \code{\link{functioname}},
#' \code{\link[packagename]{functioname}}.
#'
#' @examples
#'
#' \dontrun{
#'
#'
#'
#' }
#'
#' @export
#'
# @importFrom pack func1
#'

imp_plot_convergence <- function(param1 = some_default,
               ...
               ) {
# Use this instead or library or require inside functions:
if (!requireNamespace('some_pkg', quietly = TRUE)) {
  stop('Package some_pkg needed for this function to work. Please install it.',
  call. = FALSE)
  }

  # this is from stats_utils/stats_utils/run_mice_impute.R
  # lines 911

  # Inspect the convergence of the algorithm
  # mice() implements an iterative MCMC type of algorithm.
  # Trace lines generated by the algorithm to study convergence:
  # Plot convergence of imputed data, only plots the last 3 variables:
  svg(sprintf('convergence_plots_imputation_%s.svg', output_name))
  plot(imp_merged)
  dev.off()
  # TO DO: save legend
  # The plot shows the mean (left) and standard deviation (right)
  # of the imputed values only.
  # In general, we would like the streams to intermingle
  # and be free of any trends at the later iterations.

    return(something_I_need)
  }
EpiCompBio/bigimp documentation built on July 6, 2019, 11:39 a.m.