get_mdgc {mdgc}R Documentation

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.

Details

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

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

See Also

get_mdgc_log_ml, mdgc_start_value

Examples

# there is a bug on CRAN's check on Solaris which I have failed to reproduce.
# See https://github.com/r-hub/solarischeck/issues/8#issuecomment-796735501.
# Thus, this example is not run on Solaris
is_solaris <- tolower(Sys.info()[["sysname"]]) == "sunos"

if(!is_solaris){
  # 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)
  print(class(obj))
}


[Package mdgc version 0.1.7 Index]