[R] Plot for jump point

2008-03-30 Thread kate
Hi,

 My code is as the following,
ratio-seq(0,1,by=0.01)
payoff-NULL
for (i in 1:length(ratio) )
{
payoff1-100*(ratio[i]=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]0.7)
payoff-c(payoff,payoff1)
}
plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l')

I have the discontinuous point at ratio=0.7. I do not want to have the line at 
0.7, and would like a solid dot at payoff=100 and a hollow dot at payoff=40 at 
the jump point 0.7. How would I do this?

Thanks,   

Kate 
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Plot for jump point

2008-03-30 Thread jim holtman
Try this:

ratio-seq(0,1,by=0.01)
payoff-NULL
for (i in 1:length(ratio) )
{
payoff1-100*(ratio[i]=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]0.7)
payoff-c(payoff,payoff1)
}
payoff[70] - NA  # force no line
plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l')
points(c(ratio[69], ratio[71]), c(payoff[69], payoff[71]), pch=c(1,16))




On Sun, Mar 30, 2008 at 4:17 PM, kate [EMAIL PROTECTED] wrote:
 Hi,

  My code is as the following,
 ratio-seq(0,1,by=0.01)
 payoff-NULL
 for (i in 1:length(ratio) )
 {
 payoff1-100*(ratio[i]=0.7)+max(100*(1+(ratio[i]-1)*2),0)*(ratio[i]0.7)
 payoff-c(payoff,payoff1)
 }
 plot(ratio,payoff, xlab='ST/S0', ylab='Payoff',type='l')

 I have the discontinuous point at ratio=0.7. I do not want to have the line 
 at 0.7, and would like a solid dot at payoff=100 and a hollow dot at 
 payoff=40 at the jump point 0.7. How would I do this?

 Thanks,

 Kate
[[alternative HTML version deleted]]

 __
 R-help@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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@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.