# dist.Normal.Mixture: Mixture of Normal Distributions In LaplacesDemon: Complete Environment for Bayesian Inference

## Description

These functions provide the density, cumulative, and random generation for the mixture of univariate normal distributions with probability p, mean mu and standard deviation sigma.

## Usage

 ```1 2 3``` ```dnormm(x, p, mu, sigma, log=FALSE) pnormm(q, p, mu, sigma, lower.tail=TRUE, log.p=FALSE) rnormm(n, p, mu, sigma) ```

## Arguments

 `x,q` This is vector of values at which the density will be evaluated. `p` This is a vector of length M of probabilities for M components. The sum of the vector must be one. `n` This is the number of observations, which must be a positive integer that has length 1. `mu` This is a vector of length M that is the mean parameter mu. `sigma` This is a vector of length M that is the standard deviation parameter sigma, which must be positive. `lower.tail` Logical. This defaults to `TRUE`. `log,log.p` Logical. If `TRUE`, then probabilities p are given as log(p).

## Details

• Application: Continuous Univariate

• Density: p(theta) = sum p[i] N(mu[i], sigma[i]^2)

• Inventor: Unknown

• Notation 1: theta ~ N(mu, sigma^2)

• Notation 2: p(theta) = N(theta | mu, sigma^2)

• Parameter 1: mean parameters mu

• Parameter 2: standard deviation parameters sigma > 0

• Mean: E(theta) = sum p[i] mu[i]

• Variance: var(theta) = sum p[i] sigma[i]^(0.5)

• Mode:

A mixture distribution is a probability distribution that is a combination of other probability distributions, and each distribution is called a mixture component, or component. A probability (or weight) exists for each component, and these probabilities sum to one. A mixture distribution (though not these functions here in particular) may contain mixture components in which each component is a different probability distribution. Mixture distributions are very flexible, and are often used to represent a complex distribution with an unknown form. When the number of mixture components is unknown, Bayesian inference is the only sensible approach to estimation.

A normal mixture, or Gaussian mixture, distribution is a combination of normal probability distributions.

## Value

`dnormm` gives the density, `pnormm` returns the CDF, and `rnormm` generates random deviates.

## Author(s)

Statisticat, LLC. [email protected]

`ddirichlet` and `dnorm`.
 ```1 2 3 4 5 6 7 8``` ```library(LaplacesDemon) p <- c(0.3,0.3,0.4) mu <- c(-5, 1, 5) sigma <- c(1,2,1) x <- seq(from=-10, to=10, by=0.1) plot(x, dnormm(x, p, mu, sigma, log=FALSE), type="l") #Density plot(x, pnormm(x, p, mu, sigma), type="l") #CDF plot(density(rnormm(10000, p, mu, sigma))) #Random Deviates ```