R: Generate samples from a mixture of exponential distributions

rmixexp {diveMove} | R Documentation

## Generate samples from a mixture of exponential distributions

### Description

`rmixexp` uses a special definition for the probabilities `p_i` to generate random samples from a mixed Poisson distribution with known parameters for each process. In the two-process case, `p` represents the proportion of "fast" to "slow" events in the mixture. In the three-process case, `p_0` represents the proportion of "fast" to "slow" events, and `p_1` represents the proportion of "slow" to "slow" *and* "very slow" events.

### Usage

    rmixexp(n, p, lambdas)

### Arguments

`n` | integer output sample size.
`p` | numeric probabilities for processes generating the output mixture sample.
`lambdas` | numeric `lambda` (rate) for each process.

### Value

vector of samples.

### Examples

    ## Draw samples from a mixture where the first process occurs with
    ## p < 0.7, and the second process occurs with the remaining
    ## probability.
    p <- 0.7
    lda <- c(0.05, 0.005)
    (rndprocs2 <- rmixexp(1000, p, lda))

    ## 3-process
    p_f <- 0.6    # fast to slow
    p_svs <- 0.7  # prop of slow to (slow + very slow) procs
    p_true <- c(p_f, p_svs)
    lda_true <- c(0.05, 0.01, 8e-4)
    (rndprocs3 <- rmixexp(1000, p_true, lda_true))

[Package diveMove version 1.6.0 Index]