density: Compute densities of a Gaussian mixture model

View source: R/density.R

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


gmgm documentation built on Sept. 9, 2022, 1:07 a.m.