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

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Tue, 22 Jul 2008 13:31:57 -0700

On 7/22/08, John Smith <zmring_at_gmail.com> wrote:
> Thanks, Deepayan,
>
> I actually want to have a picture like the Figure 5.9 in "Mixed-Effects
> Models in S and S-PLUS", which have a separate panel for each function and
> has the function name been printed in strip.

xyplot(linear(d) + logistic(d) + umbrella(d) ~ d,

      data = list(d = seq(-5, 5, length = 101)),
      type = "l", outer = TRUE)

There are several ways to make the strip labels just the names; the simplest is to create a data frame with all the necessary columns beforehand.

-Deepayan

>
> Thanks
>
>
>
> On Tue, Jul 22, 2008 at 1:08 PM, Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
> wrote:
>
>
> > 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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Jul 2008 - 21:37:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Aug 2008 - 21:33:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive