sim_single_stages: The total number of colony-forming units in the mixed sample...

View source: R/sim_single_stages.R

sim_single_stagesR Documentation

The total number of colony-forming units in the mixed sample by the simulation results in the single mixing plan with l number of stages.

Description

This function gives a simulated number of CFUs after each stage of the mixing process.

Usage

sim_single_stages(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 colony-forming units in the mixed sample which is produced by contribution of k primary samples mixing, N' = \sum N_i and l be the number of stages in the mixing process. This function provides simulated number of CFUs after each stages of the mixing process. To more details, please refer the details section of compare_mixing_3.

Value

average number of colony forming units in the single mixing plan with l number of stages.

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

Examples

mu <- 100
sigma <- 0.8
alpha_in <- 0.01
k <- 30
l <- 25000
r <- 0.01
distribution <-  "Poisson lognormal-Type B"
n_sim <- 2000
stages <-c(1:l)
Prob_df <-
data.frame(stages,sim_single_stages(mu,sigma,alpha_in,k,l,r,distribution,n_sim))
colnames(Prob_df) <- c("no.revolutions","CFU")
plot_sim_single_stages <- ggplot2::ggplot(Prob_df,ggplot2::aes(x = no.revolutions, y = CFU)) +
ggplot2::geom_line() +
# tidyquant::geom_ma(ma_fun = SMA, n = 50, linetype = 1, colour = "red") +
ggplot2::xlab(expression("Number of revolutions")) +
ggplot2::ylab(expression("Expected total number of CFUs")) +
ggplot2::theme_classic() +
ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5)) +
ggthemes::scale_colour_colorblind()
print(plot_sim_single_stages)

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