Skip to contents

The Two Component Mixture Normal Distribution

Usage

pmnorm(q, mu, sigma, lambda, log = FALSE, verbose = FALSE)

dmnorm(x, mu, sigma, lambda, log = FALSE, verbose = FALSE)

Arguments

q, x

(Vector). Values to calculate distributional values of.

mu

(Vector). A two value vector of mean values.

sigma

(Vector). A two value vector of component-wise variances

lambda

(Vector). A two value vector of component mixing coefficients

log

(Boolean). Whether returning probabilities are in log format

verbose

(Boolean). Whether to return component values.

Value

A numeric value representing the probability density value of a two-component mixture distribution

Functions

  • pmnorm: Cumulative Distribution Function

  • dmnorm: Probability Density Function

Examples

    library(mixtools)
#> mixtools package, version 1.2.0, Released 2020-02-05
#> This package is based upon work supported by the National Science Foundation under Grant No. SES-0518772.
    lambda <- c(0.7,0.3)
    mu <- c(1,2)
    sigma <- c(1,1)
    v <- rnormmix(100, lambda=lambda, mu=mu, sigma=sigma)
    pmnorm(v, lambda=lambda,mu=mu,sigma=sigma)
#>   [1] 0.772633700 0.203431536 0.500517717 0.357977205 0.452494974 0.369496574
#>   [7] 0.726615067 0.834978500 0.606652802 0.349852072 0.819880347 0.978272700
#>  [13] 0.835018828 0.502745835 0.924223165 0.361403540 0.050821453 0.614899331
#>  [19] 0.613353898 0.480917952 0.500077384 0.922163456 0.611167257 0.358453141
#>  [25] 0.227685406 0.118587472 0.029402379 0.697187332 0.260898535 0.567737031
#>  [31] 0.188993167 0.282017566 0.103990229 0.303576175 0.401919200 0.544311884
#>  [37] 0.847897779 0.426291023 0.852417514 0.838289525 0.352996309 0.219983755
#>  [43] 0.752835393 0.413662794 0.055768785 0.989435511 0.157496656 0.491749265
#>  [49] 0.355987683 0.531203812 0.829582201 0.106422950 0.869838007 0.157799185
#>  [55] 0.117364241 0.532471487 0.573395981 0.450741970 0.171064863 0.367171011
#>  [61] 0.741749105 0.628157897 0.227508059 0.135095967 0.374264733 0.854395753
#>  [67] 0.037043601 0.100964468 0.887085115 0.473827199 0.706151707 0.078029555
#>  [73] 0.249056534 0.186168696 0.888225001 0.083696015 0.095301953 0.400292786
#>  [79] 0.491133330 0.656991114 0.812453972 0.395840845 0.177674413 0.269541294
#>  [85] 0.410485455 0.474147520 0.635783369 0.450488366 0.321201201 0.863587171
#>  [91] 0.888629102 0.488258531 0.379850972 0.881581826 0.954653797 0.439981723
#>  [97] 0.952482378 0.979950648 0.717997421 0.006667643
    dmnorm(v, lambda=lambda,mu=mu,sigma=sigma)
#>   [1] 0.26779918 0.26287804 0.36080940 0.34178695 0.35964852 0.34510656
#>   [7] 0.29608732 0.21978405 0.34503418 0.33924792 0.23252550 0.04643530
#>  [13] 0.21974899 0.36073716 0.12633448 0.34280850 0.09930783 0.34274839
#>  [19] 0.34318854 0.36096460 0.36082236 0.12892196 0.34380201 0.34193058
#>  [25] 0.27989145 0.18634075 0.06395805 0.31129738 0.30019161 0.35374715
#>  [31] 0.25181060 0.31141039 0.16997735 0.32157887 0.35272045 0.35735402
#>  [37] 0.20826500 0.35680040 0.20409480 0.21688739 0.34024998 0.27469665
#>  [43] 0.28066566 0.35486018 0.10678090 0.02517920 0.22503377 0.36098557
#>  [49] 0.34118043 0.35883752 0.22442505 0.17278187 0.18730346 0.22530917
#>  [55] 0.18501131 0.35871081 0.35269172 0.35950720 0.23702967 0.34446267
#>  [61] 0.28740659 0.33874813 0.27977396 0.20358134 0.34638541 0.20224599
#>  [67] 0.07719754 0.16644413 0.16947597 0.36080765 0.30689328 0.13791314
#>  [73] 0.29333571 0.24955987 0.16825255 0.14526639 0.15969408 0.35239844
#>  [79] 0.36099146 0.32864950 0.23852030 0.35148492 0.24261693 0.30493665
#>  [85] 0.35431329 0.36081719 0.33626473 0.35948618 0.32896331 0.19346312
#>  [91] 0.16781744 0.36100765 0.34781335 0.17530183 0.08472048 0.35848559
#>  [97] 0.08793114 0.04341500 0.30076687 0.01803274