| dmixnorm_cpp | R Documentation |
The function dmixnorm() computes the density of a mixture of multivariate
normal distribution.
The function pmixnorm() computes the cumulative distribution function of a
mixture of multivariate normal distribution.
The function rmixnorm() samples from a mixture of multivariate normal
distribution.
The functions with suffix _cpp perform no input checks, hence are faster.
The univariate normal mixture is available as the special case p = 1.
dmixnorm_cpp(x, mean, Sigma, proportions)
pmixnorm_cpp(x, mean, Sigma, proportions, abseps = 0.001)
rmixnorm_cpp(mean, Sigma, proportions)
dmixnorm(x, mean, Sigma, proportions)
pmixnorm(x, mean, Sigma, proportions, abseps = 0.001)
rmixnorm(n = 1, mean, Sigma, proportions)
x |
[ |
mean |
[ |
Sigma |
[ |
proportions |
[ If proportions do not sum to unity, they are rescaled to do so. |
abseps |
[ |
n |
[ |
pmixnorm() is based on mvtnorm::pmvnorm with the randomized
Quasi-Monte-Carlo procedure by Genz and Bretz. The argument abseps controls
the accuracy of the Gaussian integral approximation.
For dmixnorm(): The density value.
For pmixnorm(): The value of the distribution function.
For rmixnorm(): If n = 1 a vector of length p (note
that it is a column vector for rmixnorm_cpp()), else
a matrix of dimension n times p with samples as rows.
Other simulation helpers:
Simulator,
correlated_regressors(),
ddirichlet_cpp(),
dmvnorm_cpp(),
dtnorm_cpp(),
dwishart_cpp(),
gaussian_tv(),
simulate_markov_chain()
x <- c(0, 0)
mean <- matrix(c(-1, -1, 0, 0), ncol = 2)
Sigma <- matrix(c(diag(2), diag(2)), ncol = 2)
proportions <- c(0.7, 0.3)
# compute density
dmixnorm(x = x, mean = mean, Sigma = Sigma, proportions = proportions)
# compute CDF
pmixnorm(x = x, mean = mean, Sigma = Sigma, proportions = proportions)
# sample
rmixnorm(n = 3, mean = mean, Sigma = Sigma, proportions = proportions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.