add_var {gmgm}R Documentation

Add variables to a Gaussian mixture model

Description

This function adds variables to a Gaussian mixture model.

Usage

add_var(gmm, var)

Arguments

gmm

An object of class gmm. If NULL, a gmm object is created with the added variables and one mixture component.

var

A character vector containing the added variables, or a data frame or numeric matrix whose columns are named after the added variables. In the first case, for each mixture component, the marginal mean vector of the added variables is 0 and the marginal covariance matrix the identity matrix. In the second case, these mean vector and covariance matrix are computed from the data (after removing the rows that contain missing values).

Value

The gmm object after adding the variables.

See Also

remove_var, rename_var

Examples

data(gmm_body, data_body)
gmm_1 <- add_var(gmm_body, "GENDER")
gmm_2 <- add_var(gmm_body, data_body[, "GENDER"])


[Package gmgm version 1.1.2 Index]