Learn R Programming

gmgm (version 1.1.2)

add_var: Add variables to a Gaussian mixture model

Description

This function adds variables to a Gaussian mixture model.

Usage

add_var(gmm, var)

Value

The gmm object after adding the variables.

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

See Also

remove_var, rename_var

Examples

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

Run the code above in your browser using DataLab