View source: R/simulation.R View source: R/original/Additional file 2.R
simulate_linear | R Documentation |
Simulates linear trends with p fraction decreasing and (1-p) fraction increasing.
simulate_linear(n, n.samples, p)
n |
Number of trends to generate. |
n.samples |
Number of timepoints within each trend. |
p |
Proportion of trends decreasing (vs. increasing). |
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).
trends <- simulate_linear(1000, 100, 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.