rtruncmix: Random Draws from a Truncated Normal Mixture

Description Usage Arguments Value Author(s) Examples

View source: R/MTfuncs_all.R

Description

Random Draws from a Truncated Normal Mixture

Usage

1
rtruncmix(length, mu = 0, sig = 1, p = 1, lwr = -1, upr = 1)

Arguments

length

The number of observations to generate

mu

Vector of mean parameters, one for each normal component

sig

Vector of standard deviation parameters, one for each normal component

p

Vector of proportion parameters, one for each normal component. These do not have to add to one, and can even represent counts.

lwr

Lower truncation bound

upr

Upper truncation bound

Value

A vector of random draws (numeric)

Author(s)

Matt Tyers

Examples

1
2
draws <- rtruncmix(length=100000, mu=c(0,3,10), sig=c(.5,1,2),p=c(1,1,1), lwr=0, upr=8)
plot(density(draws,bw=.1))

mbtyers/MTfuncs documentation built on May 22, 2019, 12:58 p.m.