GetDataFrame: Convert imputed data to a dataframe, using the same setting...

Description Usage Arguments Value Examples

View source: R/ArrayUtils.R

Description

This is a utility function to convert the imputed data matrix to a dataframe. This function will be implemented as a RCPP internal function later on.

Usage

1
GetDataFrame(dest, from, cols = 1:NCOL(from))

Arguments

dest

the imputed output data matrix.

from

the original input dataframe.

cols

optinal. Always use default for now.

Value

The returned dataframe object for imputed data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
require(NPBayesImpute)
#Please use NYexample data set for a more realistic example
data('NYMockexample')

#create the model
model <- CreateModel(X,MCZ,10,10000,0.25,0.25)

#run 1 burnins, 2 mcmc iterations and thin every 2 iterations
model$Run(1,2,2)

#retrieve parameters from the final iteration
result <- model$snapshot

#convert ImputedX matrix to dataframe, using proper factors/names etc.
ImputedX <- GetDataFrame(result$ImputedX,X)
#View(ImputedX)

Example output

Loading required package: Rcpp
Initializing...
Run model with structural zeros.
iter = 0  kstar = 10 alpha = 0.03 Nmis = 380
iter = 0  kstar = 10 alpha = 2.88893 Nmis = 406
iter = 1  kstar = 10 alpha = 1.66954 Nmis = 424

NPBayesImpute documentation built on May 29, 2017, 11:12 p.m.