Learn R Programming

mdgc (version 0.1.2)

get_mdgc_log_ml: Get Pointer to C++ Object to Approximate the Log Marginal Likelihood

Description

Creates a C++ object which is needed to approximate the log marginal likelihood. The object cannot be saved.

Usage

get_mdgc_log_ml(object, ...)

# S3 method for mdgc get_mdgc_log_ml(object, ...)

# S3 method for data.frame get_mdgc_log_ml(object, ...)

# S3 method for default get_mdgc_log_ml( object, lower, upper, code, multinomial, idx_non_zero_mean, ... )

Arguments

object

mdgc object from get_mdgc or a data.frame to pass to get_mdgc. Ignored by the default method.

...

used to pass arguments to S3 methods.

lower

[# variables]x[# observations] matrix with lower bounds for each variable on the normal scale.

upper

[# variables]x[# observations] matrix with upper bounds for each variable on the normal scale.

code

[# variables]x[# observations] matrix integer code for the each variable on the normal scale. Zero implies an observed value (the value in upper), one implies a missing value, and two implies an interval.

multinomial

list where each element is 3x[# multinomial variables] matrix with multinomial outcomes. The first index is the outcome as an integer code, the second index is the number of categories, and the third index is the index of each multinomial variable (this is zero-based).

idx_non_zero_mean

indices for non-zero mean variables. Indices should be sorted.

Value

A Rcpp::XPtr to pass to e.g. mdgc_log_ml.

Details

Indices are zero-based except the outcome index for multinomial variables.

idx_non_zero_mean indices with terms with code equal to zero (observed values) are ignored.

See Also

mdgc_fit, mdgc_log_ml

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)
ptr <- get_mdgc_log_ml(obj)

# }

Run the code above in your browser using DataLab