[R] Lattice: How to draw curves from given formulae

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Jul 22 19:08:44 CEST 2008


On 7/21/08, John Smith <zmring at gmail.com> wrote:
> Dear R Users:
>
>  I have a list function as:
>  Flat:  y = 0
>  Linear: y = -(1.65/8)d
>  Logistic: y = 0.015 - 1.73/{1+exp[1.2(4-d)]}
>  Umbrella: y= -(1.65/3)d + (1.65/36)d^2
>  Emax: y = -1.81d/(0.79+d)
>  Sigmoid Emax: y = -1.70d^5/(4^5+d^5)
>
>  And want draw the figure as attached (those material are extracted from a
>  paper). Could anyone give me a sample code to do this?

The attachment didn't come through, but here's one approach (with
three of your functions):

linear <- function(d) -(1.65/8) * d
logistic <- function(d) 0.015 - 1.73 / (1 + exp(1.2 * (4-d)))
umbrella <- function(d) -(1.65/3) * d + (1.65 / 36) * d^2

xyplot(linear(d) + logistic(d) + umbrella(d) ~ d,
       data = list(d = seq(-5, 5, length = 101)),
       type = "l",
       auto.key = list(lines = TRUE, points = FALSE))

-Deepayan



More information about the R-help mailing list