sampling {gmgm}R Documentation

Sample a Gaussian mixture model

Description

This function samples a Gaussian mixture model.

Usage

sampling(gmm, data_x = NULL, n = 1)

Arguments

gmm

An object of class gmm.

data_x

A data frame or numeric matrix containing observations of the explanatory variables if conditional sampling is performed. Its columns must explicitly be named after the explanatory variables. If NULL (the default), joint sampling is performed.

n

A non-negative integer corresponding to the number of samples. If conditional sampling is performed, this argument is ignored.

Value

A numeric matrix containing the samples.

See Also

density, expectation

Examples

set.seed(0)
data(gmm_body, data_body)
sampl_1 <- sampling(gmm_body, n = 500)
sampl_2 <- sampling(gmm_body,
                    data_body[, c("WEIGHT", "FAT", "HEIGHT", "AGE")])


[Package gmgm version 1.1.2 Index]