rmixnorm: Generate mixed normal random number.

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/rmixnorm.R

Description

Random generation for the mixed normal distribution with mixed probability equal to P, mean vector equal to vmu and standard deviation vector equal to vsigma.

Usage

1
  rmixnorm(n, P, vmu, vsigma)

Arguments

n

a positive integer, the number of random numbers.

P

a vector, the mixed probability vector.

vmu

a vector, the corresponding mean vector.

vsigma

a vector, the corresponding sd vector.

Value

Return a vector with length equal to n.

Note

nothing

Author(s)

Liu Wei

References

Nothing.

See Also

xtable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    # example one
    N <- 300
    P <- c(0.2, 0.8)
    mu <- c(-5,5)
    sigma <- c(sqrt(6), sqrt(3))
    set.seed(1)
    samples <- rmixnorm(N,P, mu, sigma)
    samples
    plot(density(samples))
  

feiyoung/simutool documentation built on Sept. 15, 2021, 10:14 p.m.