mixture

mixture, function

def nosort process mixture(r: ranvar): ranvar
def nosort process mixture(r: ranvar, w: number): ranvar
def pure mixture(r1: ranvar, p1: number, r2: ranvar): ranvar
def pure mixture(r1: ranvar, p1: number, r2: ranvar, p2: number, r3: ranvar): ranvar
def pure mixture(r1: ranvar, p1: number, r2: ranvar, p2: number,
  r3: ranvar, p3: number, r4: ranvar): ranvar

Returns a mixture of ranvars, either as an aggregator or as a weighted pure function.

Examples

table T = with
  [| as Group, as Mean |]
  [| "A", 1 |]
  [| "A", 3 |]
  [| "B", 2 |]

T.R = poisson(T.Mean)

table G[g] = by T.Group
G.Mix = mixture(T.R)

show table "Mixture" with
  g as "Group"
  mean(G.Mix) as "Mean"

This produces the following table:

Group Mean
A 1.999662
B 1.999924
r1 = poisson(1)
r2 = poisson(3)

show table "Weighted" with
  mean(mixture(r1, 0.25, r2)) as "Mean"

This produces the following table:

Mean
2.499748

Remarks

Weights must be non-negative. Empty groups return dirac(0).

User Contributed Notes
0 notes + add a note