Learn R Programming

mdgc (version 0.1.2)

get_mdgc: Get mdgc Object

Description

Creates a mdgc object which is needed for estimation of the covariance matrix and the mean vector and to perform imputation.

Usage

get_mdgc(dat)

Arguments

dat

data.frame with continuous, multinomial, ordinal, and binary variables.

Value

An object of class mdgc. It has the following elements:

lower,upper,code,multinomial,idx_non_zero_mean

arguments to pass to get_mdgc_log_ml.

margs

functions to get lower and upper bounds for each column of dat.

reals,bins,ords

indices of continuous, binary, and ordinal variables, respectively.

truth

the numeric version of dat.

means

starting values for the non-zero mean terms (see e.g. mdgc_fit).

Details

It is important to use appropriate classes for the data.frame columns:

  • Continuous variables: should be numerics.

  • Binary variables: should be logicals.

  • Multinomial variables: should be factors.

  • Ordinal variables: should be ordered.

See Also

get_mdgc_log_ml, mdgc_start_value

Examples

Run this code
# NOT RUN {
# randomly mask data
set.seed(11)
masked_data <- iris
masked_data[matrix(runif(prod(dim(iris))) < .10, NROW(iris))] <- NA

# use the functions in the package
library(mdgc)
obj <- get_mdgc(masked_data)
class(obj)

# }

Run the code above in your browser using DataLab