mixt: Normal and t-mixture distributions

Description Usage Arguments Details Value Examples

Description

Random generation and density values from normal and t-mixture distributions.

Usage

1
2
3
4
5
6
dnorm.mixt(x, mus=0, sigmas=1, props=1)
rnorm.mixt(n=100, mus=0, sigmas=1, props=1, mixt.label=FALSE)
dmvnorm.mixt(x, mus, Sigmas, props)
rmvnorm.mixt(n=100, mus=c(0,0), Sigmas=diag(2), props=1, mixt.label=FALSE)
rmvt.mixt(n=100, mus=c(0,0), Sigmas=diag(2), dfs=7, props=1)
dmvt.mixt(x, mus, Sigmas, dfs, props)

Arguments

n

number of random variates

x

matrix of quantiles

mus

(stacked) matrix of mean vectors (>1-d) or vector of means (1-d)

Sigmas

(stacked) matrix of variance matrices (>1-d)

sigmas

vector of standard deviations (1-d)

props

vector of mixing proportions

mixt.label

flag to output numeric label indicating mixture component. Default is FALSE.

dfs

vector of degrees of freedom

Details

rmvnorm.mixt and dmvnorm.mixt are based on the rmvnorm and dmvnorm functions from the mvtnorm package. Likewise for rmvt.mixt and dmvt.mixt.

Value

Normal and t-mixture random vectors and density values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## univariate normal mixture
x <- rnorm.mixt(1000, mus=c(-1,1), sigmas=c(0.5, 0.5), props=c(1/2, 1/2))

## bivariate mixtures 
mus <- rbind(c(-3/2,0), c(3/2,0))
Sigmas <- rbind(diag(c(1/16, 1)), rbind(c(1/16, 1/18), c(1/18, 1/16)))
props <- c(2/3, 1/3)
dfs <- c(7,3)
x <- rmvnorm.mixt(1000, mus=mus, Sigmas=Sigmas, props=props)
y <- rmvt.mixt(1000, mus=mus, Sigmas=Sigmas, dfs=dfs, props=props)

ks documentation built on July 4, 2017, 9:45 a.m.

Search within the ks package
Search all R packages, documentation and source code