Description Usage Arguments Details Value References Examples

CreateModel creates and initializes an Rcpp_Lcm Rcpp_Lcm-class object for non-parametric multiple imputation of discrete multivariate categorical data with or without structural zeros.

1 | ```
CreateModel(X, MCZ, K, Nmax, aalpha, balpha)
``` |

`X` |
a data frame with the dataset with missing values. All variables must be unordered factors. |

`MCZ` |
a dataframe with the definition of the structural zeros. Placeholder components are represented with NAs. Variables in MCZ must be factors with the same levels as X. Rows do not need to define disjoint regions of the contingency table. See Manrique-Vallier and Reiter (2014) for details of the definition of structural zeros. MCZ should be set to NULL when there are no structure zeros. |

`K` |
the maximum number of mixture components. |

`Nmax` |
An upper truncation limit for the augmented sample size. This parameter will be ignored(set to 0) when there is no structural zeros. |

`aalpha` |
the hyper parameter 'a' for alpha in stick-breaking prior distribution. |

`balpha` |
the hyper parameter 'b' for alpha in stick-breaking prior distribution. |

This should be the first function one should call to use the library. The returned model object will be referenced in all subsequent calls.

CreateModel returns an Rcpp_lcm object. The returned model object will be referenced in all subsequent calls.

Manrique-Vallier, D. and Reiter, J.P. (2013), "Bayesian Estimation of Discrete Multivariate Latent Structure Models with Structural Zeros", JCGS.

Si, Y. and Reiter, J.P. (2013), "Nonparametric Bayesian multiple imputation for incomplete categorical variables in large-scale assessment surveys", Journal of Educational and Behavioral Statistics, 38, 499 - 521

Manrique-Vallier, D. and Reiter, J.P. (2014), "Bayesian Multiple Imputation for Large-Scale Categorical Data with Structural Zeros", Survey Methodology.

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)
``` |

```
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.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.