compare_mixing_3: Graphical comparison of mixing plans based on cumulative...

View source: R/compare_mixing_3.R

compare_mixing_3R Documentation

Graphical comparison of mixing plans based on cumulative distribution of expected total CFUs in the mixing process.

Description

This function provides a graphical display to compare mixing plans based on the cumulative distribution of expected total CFUs in the mixing process using different mixing parameters, such as type of distribution and number of primary samples.

Usage

compare_mixing_3(mu, sigma, alpha_in, k, l, r, distribution, n_sim)

Arguments

mu

the average number of CFUs (\mu) in the mixed sample, which is in a logarithmic scale if we use a Lognormal / Poisson lognormal distribution

sigma

the standard deviation of the colony-forming units in the mixed sample on the logarithmic scale (default value 0.8)

alpha_in

concentration parameter at the initial stage

k

number of small portions / primary samples

l

number of revolutions / stages

r

the rate of the concentration parameter changes at each mixing stage

distribution

what suitable distribution type we have employed for simulation such as "Poisson-Type A" or "Poisson-Type B" or "Lognormal-Type A" or "Lognormal-Type B" or "Poisson lognormal-Type A" or "Poisson lognormal-Type B"

n_sim

number of simulations

Details

Let N' be the number of CFUs in the mixed sample, which is produced by the mixing of k primary samples and N' = \sum N_i and let N_i be the number of CFUs in the i^{th} primary sample; where i = 1,2,....k.

For this package development, we have employed the notations 'Type-A' and 'Type-B' to indicate the type of distributions, which are applied in the previous literature as 'fair' and 'beta', respectively; see Nauta (2005).

Following Nauta (2005), the contribution weight of contamination by each primary sample can be defined by the random variable w_i, which is possible to be followed by either uniform distribution with parameter 1/k or the joint distribution of w_1,w_2,\cdots w_k follows a Dirichlet distribution with concentration parameter \alpha. From the previous literature, a Dirichlet distribution can be formulated by beta or gamma algorithms, which have revealed the same results; see Nauta (2005).

This function is developed based on the beta algorithm and the following steps formulate it.

w_i = x_i {\prod_{j=1}^{i-1}{1-x_j}}~~~~ \forall i = 2,3,\cdots k,~~~~~ w_1=x_1

;

where x_i follows Beta (\alpha,\alpha(k-i)) and also \sum w_i must be equal to one.

  • Case 1 (Poisson-Type A): N_i follows Poisson(\mu/k)

  • Case 2 (Poisson-Type B): N_i follows Poisson(\mu w_i)

  • Case 3 (Lognormal-Type A): N_i follows Binomial(M_i,1/k); where M_i follows Lognormal(\mu, \sigma)

  • Case 4 (Lognormal-Type B): N_i follows Binomial(M_i,w_i); where M_i follows Lognormal(\mu, \sigma)

  • Case 5 (Poisson lognormal-Type A): N_i follows Binomial(M_i,1/k); where M_i

    follows Poisson lognormal (\mu, \sigma)

  • Case 6 (Poisson lognormal-Type B): N_i follows Binomial(M_i,w_i); where M_i

    follows Poisson lognormal(\mu, \sigma)

The powder-mixing process can be defined as breaking clusters stage-by-stage. Usually, it occurs systematically in the standard powder mixtures. For this package development, we assume that mixing parameters also systematically change with a fixed rate at each stage of the mixing. The mixing parameter can be defined as revolutions instead of the mixing stage in general. Due to the lack of theoretical results for the dependent random variable sum's distribution, we have chosen simulation techniques for this modelling.

Let l be the number of stages or revolutions of the mixture, and we also assumed a fixed concentration parameter value at the initial phase of the mixing process. Based on the literature in this area, the concentration parameter can be assumed to increase at every stage of the mixing, which is possible to do systematically.

Therefore, this function exhibits the graphical display with different quantities of primary sample mixing as a large unit.

Value

Graphical comparison between different mixing schemes.

References

  • Nauta, M.J., 2005. Microbiological risk assessment models for partitioning and mixing during food handling. International Journal of Food Microbiology 100, 311-322.

See Also

sim_single, sim_single_stages, sim_multiple_stages

Examples

mu <- 100
sigma <- 0.8
alpha_in <- 0.01
k <- c(10,30,60)
r <- 0.01
distribution <- c("Poisson lognormal-Type B","Poisson lognormal-Type B","Poisson lognormal-Type B")
n_sim <- 2000
plot1 <- compare_mixing_3(mu, sigma, alpha_in, k , l = 250,r, distribution,n_sim) +
ggplot2::theme(legend.text = ggplot2::element_text(size = 7.5),
legend.title = ggplot2::element_text(size = 7.5),
legend.key.size = ggplot2::unit(4, 'mm'))
#+ ggplot2::xlim(0,300)
plot2 <- compare_mixing_3(mu, sigma, alpha_in, k , l = 500, r, distribution, n_sim) +
ggplot2::theme(legend.title = ggplot2::element_text(size = 7.5),
legend.key.size = ggplot2::unit(4, 'mm'))
plot3 <- compare_mixing_3(mu, sigma, alpha_in, k, l = 5000,r , distribution,n_sim) +
ggplot2::theme(legend.text = ggplot2::element_text(size = 7.5),
legend.title = ggplot2::element_text(size = 7.5),
legend.key.size = ggplot2::unit(4, 'mm'))
plot4 <- compare_mixing_3(mu, sigma , alpha_in , k , l = 25000, r , distribution ,n_sim) +
ggplot2::theme(legend.text = ggplot2::element_text(size = 7.5),
legend.title = ggplot2::element_text(size = 7.5),
legend.key.size = ggplot2::unit(4, 'mm'))
gridExtra::grid.arrange(plot1, plot2, plot3, plot4, ncol = 2, nrow = 2)

Mayooran1987/mixingsimulation documentation built on May 12, 2023, 12:36 a.m.