compose.Rd
For two arbitrary distributions \(\pi(K)\) and \(\kappa(L)\), for which \(\pi^{K\cap L}\) is absolutely continuous with respect to \(\kappa^{K\cap L}\), their composition is, for each \(x \in X(K\cup L)\), given by the following formula: $$(\pi \triangleright \kappa)(x) = \frac{\pi(x^{\downarrow K})\kappa(x^{\downarrow L})}{\kappa^{\downarrow K\cap L}(x^{\downarrow K \cap L})}.$$ In a case where the absolute continuity is not valid, the composition remains undefined.
Insert a probability distribution to an arbitrary position of a compositional model. Default - insert to the last position
compose(Pi, K) # S3 method for Distribution compose(Pi, K) # S3 method for Model compose(model, distribution, position = -1) # S3 method for Model insert(model, distribution, position = -1)
Pi | left Distribution |
---|---|
K | right Distribution |
model | Compositional model |
distribution | Probability distribution |
position | if position == -1, the distribution is put at the end of the generating sequence |
Distribution \((\pi \triangleright \kappa)(K \cup L)\), which arose by composition of the input distributions \(\pi(K)\) and \(\kappa(L)\).
Compositional model
Distribution
: Compose two probability distributions
Model
: Add a distribution to a compositional model
Distribution
, Model
,
multiply
, *
, anticipate
,
insert
, delete
, replace
# -- Distribution class -- # define two distributions Pi <- Distribution("pi"); K <- Distribution("kappa"); # load data to the distributions data <- matrix(c(0,0,1,1), byrow = T, ncol = 2) colnames(data) <- c("A", "B") dTable(Pi) <- ( data) data <- matrix(c(0,0,0,1), byrow = T, ncol = 2) colnames(data) <- c("B", "C") dTable(K) <- ( data) # compose the distributions PiK <- compose(Pi, K) # show the result getData(PiK)#> B A C MUDIM.frequency #> 1: 0 0 0 0.5 #> 2: 0 0 1 0.5