Learn R Programming

gmgm (version 1.1.2)

density: 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)

Value

A numeric vector containing the (log-)densities.

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.

See Also

expectation, sampling

Examples

Run this code
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)

Run the code above in your browser using DataLab