summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-02-07 01:40:54 +0530
committerSuraj Yerramilli2015-02-07 01:40:54 +0530
commitbd6bfe89cc621dd8ffa8d1f57b07b1c3d136221b (patch)
treec31ee79add23c1f652cb06293bf73b5b076b1452 /R
parent874b3143a745cdd135ef2baacc812fffb46f2ddd (diff)
downloadSysID-R-code-bd6bfe89cc621dd8ffa8d1f57b07b1c3d136221b.tar.gz
SysID-R-code-bd6bfe89cc621dd8ffa8d1f57b07b1c3d136221b.tar.bz2
SysID-R-code-bd6bfe89cc621dd8ffa8d1f57b07b1c3d136221b.zip
added documentation for the imputing function
Diffstat (limited to 'R')
-rw-r--r--R/preProcess.R36
1 files changed, 36 insertions, 0 deletions
diff --git a/R/preProcess.R b/R/preProcess.R
new file mode 100644
index 0000000..0adb56c
--- /dev/null
+++ b/R/preProcess.R
@@ -0,0 +1,36 @@
+#' Impute missing values
+#'
+#' Uses the bootstrap EM Algorithm on incomplete data and creates imputed datasets
+#'
+#' @param data an object of class \code{idframe}
+#' @param m the number of imputed datasets to create.
+#'
+#' @return
+#' A list containing the following elements
+#'
+#' \tabular{ll}{
+#' \code{imputations} \tab a list of length \code{m} with an imputed dataset in each
+#' entry. Each element is of class \code{idframe} \cr
+#' \code{m} \tab an integer indicating the number of imputations run
+#' }
+#'
+#' @details
+#' This function uses the \code{\link[Amelia]{amelia}} function, provided by the
+#' \pkg{amelia} package, to perform multiple imputation.
+#'
+#' @references
+#' Honaker, J., King, G., Blackwell, M. (2011). Amelia II: A Program for Missing Data.
+#' Journal of Statistical Software, 45(7), 1–47. URL http://www.jstatsoft.org/v45/i07/.
+#'
+#' @seealso \code{\link[Amelia]{amelia}}
+#' @export
+dataImpute <- function(data,m=5){
+ # check if the class is correct
+ if(class(data)!='idframe')
+ stop("Not an idframe data")
+
+ ninputs <- dim(data$input)[2]
+ dataMatrix <- cbind(data$input,data$output)
+
+ a.out <- amelia(dataMatrix,m=5,p2s = 0)
+} \ No newline at end of file