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 |
|
Details
It is important to use appropriate classes for the data.frame
columns:
Continuous variables: should be
numeric
s.Binary variables: should be
logical
s.Multinomial variables: should be
factor
s.Ordinal variables: should be
ordered
.
Value
An object of class mdgc
. It has the following elements:
lower , upper , code , multinomial , idx_non_zero_mean |
arguments to pass to
|
margs |
functions to get |
reals , bins , ords |
indices of continuous, binary, and ordinal variables, respectively. |
truth |
the numeric version of |
means |
starting values for the non-zero mean terms
(see e.g. |
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))
}