drawFromMixed: draw random variables from a mixed distribution

Description Usage Arguments Value Author(s) Examples

Description

draw random variables from a mixed distribution

Usage

1
  drawFromMixed(n, li, p)

Arguments

n

number of total draws from all distributions

li

named list of random distribution functions that contains vectors of with corresponding function parameters

probs

vector of drawing probabilities from different functions which has to be the same length as list

Value

vec vector of random variables

Author(s)

Matthias Bannert

Examples

1
2
3
4
5
6
7
8
9
# n is the number of draws from ALL distributions
w <- drawFromMixed(100, list(rnorm = list(mean = 1000, sd = 250),
                             rexp = list(),
                             rchisq = list(df = 10)),
                             c(0.1, 0.5, 0.4))

w1 <- unlist(w) 
names(w1) <- NULL
w1

mbannert/gateveys documentation built on May 21, 2019, 2:23 p.m.