[R] Simple plot of IR and option prices

James jctoll at gmail.com
Tue Oct 16 18:32:53 CEST 2007


Hi,

I'm trying to construct what I think should be a fairly simple plot,  
yet I'm having a tremendously difficult time.  I'm trying to create a  
very simple graph showing the effect of interest rates on option  
prices.  I have three sets of option prices that I've calculated  
using rMetrics.  Each set contains a call price and a put price at a  
particular interest rate. Each set uses a different interest rate(0%, 
5%,10%).  The idea is to have "call" and "put" on the X axis, the  
option prices on Y, and to have three lines drawn from the call price  
to the put price to show how the option price varies relative to  
interest rates.  Kind of a see-saw like graph.  I need to keep this  
simple because this is meant to teach the absolute basics about the  
effects of interest rates on option prices.

These are the option prices I'm using:
CallPrice1<-CRRBinomialTreeOption(TypeFlag="ca",S=20, X=20,  
Time=1/12, r=0.0, b=0.0, sigma=.4, n=100)@price
CallPrice2<-CRRBinomialTreeOption(TypeFlag="ca",S=20, X=20,  
Time=1/12, r=.05, b=.05, sigma=.4, n=100)@price
CallPrice3<-CRRBinomialTreeOption(TypeFlag="ca",S=20, X=20,  
Time=1/12, r=.10, b=.10, sigma=.4, n=100)@price

PutPrice1<-CRRBinomialTreeOption(TypeFlag="pa",S=20, X=20, Time=1/12,  
r=0.0, b=0.0, sigma=.4, n=100)@price
PutPrice2<-CRRBinomialTreeOption(TypeFlag="pa",S=20, X=20, Time=1/12,  
r=.05, b=.05, sigma=.4, n=100)@price
PutPrice3<-CRRBinomialTreeOption(TypeFlag="pa",S=20, X=20, Time=1/12,  
r=.10, b=.10, sigma=.4, n=100)@price

L1<-c(CallPrice1, PutPrice1)
L2<-c(CallPrice2, PutPrice2)
L3<-c(CallPrice3, PutPrice3)

Everything I've tried as basically failed.  So far I've only been  
able to plot one of the lines.  And this is as far as I've gotten in  
trying to plot this:
plot(1:2, L1, type="b", main="Option Prices", xlab="Calls    and       
Puts", ylab="Option Price", lwd=3, col="dark red")

But obviously this makes the X axis 1:2 rather than "Calls" and  
"Puts", also, I've been completely unsuccessful in adding the L2 and  
L3 lines.

Any help and suggestions would be greatly appreciated.  Thanks.

James



More information about the R-help mailing list