Description Usage Arguments Value Examples
A sandbox to create and plot replicate response data with random normal error on a log scale. Enter a log scaled predictor variable and values for additional model parameter arguments. The nonlinear model formula is derived from the general hyperbolic stimulus-response function: y/ymax=x^h/(x^h+k^h), where ymax = yhi - ylo. Errors in geom_smooth fitting will occasionally happen. Just re-simulate or modify parameters. The data generating equation is: 'y = ylo + (yhi - ylo)/(1 + 10^((logk - x)*h)) + rnorm(length(x), 0, sd)' The regression formula is: 'y ~ ylo + (yhi - ylo)/(1 + 10^((logk - x)*h))“
1 |
x |
a vector of log scale values; usually log10 or log2 dose or concentration units. |
logk |
the value of x in log units that yields y/ymax = 0.5; usually logEC50 or logED50. |
ylo |
the lowest expected y value, in response units. |
yhi |
the highest expected y value, in response units. |
h |
the Hill slope, a unitless slope factor; -1 > h > 1 is steeper, -1 < h < 1 is shallower. Provide negative value for downward sloping response. |
sd |
the standard deviation of residual error, in response units. |
reps |
and integer value for number of replicates. |
ggplot, data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # x is equivalent to log10(c(1e-10, 3e-10, 1e-9, 3e-9, 1e-8, 3e-8, 1e-7, 3e-7, 1e-6)).
# note these yield approximately half unit spacing on log10 scale
simUp <- simlogdr(x = c(-10, -9.523, -9, -8.523, -8, -7.523, -7, -6.523, -6),
logk = -8, ylo = 300, yhi = 3000,
h = 1.0, sd = 100, reps = 5); simUp
# grab simulated data for other uses
simUp$data
# use negative values of h to simulate downward sloping responses
simDown <- simlogdr(x = c(-10, -9.523, -9, -8.523, -8, -7.523, -7, -6.523, -6),
logk = -8, ylo = 300, yhi = 3000,
h = -2.5, sd = 100, reps = 5); simDown
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.