Description Usage Arguments Value Examples
View source: R/original/Additional file 2.R View source: R/simulation.R
Simulates concave trends by mixing trimmed and scaled beta distributions. parameters are sampled from uniform distributions with boundaries provided as input to this function. Function y = x**(a-1)*(1-x)**(b-1), with the domain trimmed such that min(x) = c and max(x) = d (before rescaling to [0, 1])
1 | simulate_concave(n, n.samples, par1, par2 = NULL, p = 0.5)
|
n |
Number of trends to generate. |
n.samples |
Number of timepoints within each trend. |
par1 |
Parameter vector (a_min, a_max, b_min, b_max) for first set of trends |
par2 |
Optional parameter vector (a_min, a_max, b_min, b_max) for second set of trends |
p |
Proportion of trends to generate using |
A dataframe with each row representing a metabolite concentration time-course scaled between 0 and 1. The corresponding x variables are assumed to be equally spaced between 0 and 1 i.e. x <- seq(0, 1, length.out=n.samples).
1 2 3 4 5 6 7 8 9 | par1 <- c(3.5, 4.5, 2.5, 3.5, 0.0, 0.2, 0.8, 0.9)
par2 <- c(3.5, 4.5, 2.5, 3.5, 0.2, 0.4, 0.7, 0.8)
trends <- simulate_concave(1000, 100, par1, par2, 0.75)
# Conversion for plotting
y_mat <- t(as.matrix(trends))
x <- seq(0, 1, length.out=100)
matplot(x, y_mat, type = 'l', lty = 1, lwd = 4, col = grey(0, 0.05),
xlab = 'Relative culturing time', ylab = 'Relative concentration')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.