Description Usage Arguments Value Examples

View source: R/mixture_function.R

Random sample generated from an specified gaussian mixture model.

1 |

`n` |
Sample size |

`Pi` |
A vector indicating the mixing proportions |

`Mu` |
A two dimensional array where second component indicates the mean of each gaussian component |

`S` |
A three dimensional array where third component indicates the variance of each gaussian component |

`labels` |
A logical indicating whether or not a label shoud be returned indicating the component from where observation has been generated (default FALSE) |

A matrix with `n`

row and columns given by the dimension of `Mu`

and `S`

.
If `labels = T`

another column is included indicating the component from where the observation
was generated.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
Pi = c(0.5, 0.3, 0.2)
Mu = array(c(## Mu first component
5, 5,
## Mu second component
1, 1,
## Mu third component
0, 0), dim = c(2,3))
S = array(c(## Sigma first component
1, 0,
0, 1,
## Sigma second component
0.2, 0,
0, 0.2,
## Sigma third component
0.05, 0,
0, 0.05), dim = c(2, 2, 3))
X = rmixnorm(100, Pi = Pi, Mu = Mu, S = S, labels = TRUE)
plot(X[,1:2], col=X[,3])
``` |

mixpack documentation built on May 29, 2017, 11:24 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.