From: Uzuner, Tolga <tolga.uzuner_at_csfb.com>

Date: Wed 21 Dec 2005 - 05:18:26 EST

Please access the attached hyperlink for an important electronic communications disclaimer:

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 21 05:44:27 2005

Date: Wed 21 Dec 2005 - 05:18:26 EST

Hi,

I am trying to plot multiple lines on a graph.

The function is particularly simple:

sigma<-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2

which uses the variables atm, rr and str...

I define these as such:

atm<-0.4

rr<-0.2

str<-0.1

and this plots fine:

plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))

Now, I want to plot the same function for different values of str, as follows:

sapply(seq(0,0.3,0.05),function(s) {str<-s; lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

Hoping that sigma will lexically scope into str and that lines will appear on the same plot as the one I first drew above.

Instead, I just get this:

> sapply(seq(0,0.3,0.05),function(s) {str<-s; lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

*[[1]]
*

**NULL
**

*[[2]]
*

**NULL
**

*[[3]]
*

**NULL
**

*[[4]]
*

**NULL
**

*[[5]]
*

**NULL
**

*[[6]]
*

**NULL
**

*[[7]]
*

**NULL
**
and the plot does not change.

Any assistance appreciated.

Regards,

Tolga

This material is sales and trading commentary and does not constitute investment research. Please follow the attached hyperlink to an important disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml

Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 21 05:44:27 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:41:40 EST
*