View source: R/sim_single_stages.R
sim_single_stages | R Documentation |
l
number of stages.This function gives a simulated number of CFUs after each stage of the mixing process.
sim_single_stages(mu, sigma, alpha_in, k, l, r, distribution, n_sim)
mu |
the average number of CFUs ( |
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 |
n_sim |
number of simulations |
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.
average number of colony forming units in the single mixing plan with l
number of stages.
Nauta, M.J., 2005. Microbiological risk assessment models for partitioning and mixing during food handling. International Journal of Food Microbiology 100, 311-322.
sim_single
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.