gmd: Constructor for Gaussian Mixture Data

Description Usage Arguments Value Examples

Description

Constructor for Gaussian Mixture Data

Usage

1
gmd(sample, dictionary)

Arguments

sample

A data frame with 3 variables: observation which labels each observation, component which labels each mixture component and mixing which gives the weight of each component within each observation.

dictionary

A data frame with 3 variables: component which labels each mixture component and mean and precision which respectively give the mean and the precision (inverse variance) of the Gaussian distribution of the corresponding component.

Value

An object of class gmd, which is effectively a list with 2 components: sample and dictionary, as described by the input arguments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
N <- 100
M <- 4
w <- matrix(runif(N * M), N, M)
w <- w / rowSums(w)
s <- tidyr::crossing(
  observation = paste0("O", 1:N),
  component = paste0("C", 1:M)
) %>%
dplyr::mutate(mixing = as.numeric(t(w)))
d <- tibble::tibble(
  component = paste0("C", 1:M),
  mean = numeric(M),
  precision = 1:M
)
x <- gmd(s, d)

astamm/game documentation built on June 5, 2019, 8:53 a.m.