Learn R Programming

ks (version 1.8.11)

plotmixt: Plot for 1- to 3-dimensional normal and t-mixture density functions.

Description

Plot for 1- to 3-dimensional normal and t-mixture density functions.

Usage

plotmixt(mus, Sigmas, props, dfs, dist="normal", draw=TRUE, sigmas, ...)

Arguments

mus
(stacked) matrix of mean vectors
Sigmas
(stacked) matrix of variance matrices (2-d, 3-d)
sigmas
vector of standard deviations (1-d)
props
vector of mixing proportions
dfs
vector of degrees of freedom
dist
"normal" - normal mixture, "t" - t-mixture
draw
flag to draw plot. Default is TRUE.
...
other graphics parameters

Value

  • If draw=TRUE, the 1-d, 2-d plot is sent to graphics window, 3-d plot to RGL window. If draw=FALSE, then a kde-like object is returned.

Details

See the graphics parameter options in ?plot.kde.

Examples

Run this code
## unvariate 
mus <- c(0,1)
sigmas <- c(0.2, 0.5) 
props <- c(1/2, 1/2)
plotmixt(mus=mus, sigmas=sigmas, props=props)

## bivariate 
mus <- rbind(c(0,0), c(-1,1))
Sigma <- matrix(c(1, 0.7, 0.7, 1), nr=2, nc=2) 
Sigmas <- rbind(Sigma, Sigma)
props <- c(1/2, 1/2)
plotmixt(mus, Sigmas, props)

## trivariate 
mus <- rbind(c(0,0,0), c(-1,0.5,1.5))
Sigma <- matrix(c(1, 0.7, 0.7, 0.7, 1, 0.7, 0.7, 0.7, 1), nr=3, nc=3) 
Sigmas <- rbind(Sigma, Sigma)
props <- c(1/2, 1/2)
plotmixt(mus, Sigmas, props, dfs=c(3,8), dist="t")

Run the code above in your browser using DataLab