density {gmgm}R Documentation

Compute densities of a Gaussian mixture model

Description

This function computes densities of a Gaussian mixture model.

Usage

density(gmm, data, y = NULL, log = FALSE)

Arguments

gmm

An object of class gmm.

data

A data frame or numeric matrix containing the observations whose densities are computed. Its columns must explicitly be named after the variables of gmm.

y

A character vector containing the dependent variables if conditional densities are computed. If NULL (the default), joint densities are computed.

log

A logical value indicating whether the densities are returned as log-densities.

Value

A numeric vector containing the (log-)densities.

See Also

expectation, sampling

Examples

data(gmm_body, data_body)
dens_1 <- density(gmm_body, data_body, log = TRUE)
dens_2 <- density(gmm_body, data_body, y = "WAIST", log = TRUE)


[Package gmgm version 1.1.2 Index]