#Einlesen der US-JP Daten von 3 rd Jan 2000 bis 26 th Mar 2004
#Tsay, p.21
#mit Bilden von Differenzen
# R: text( ) nur innerhalb des Plot-Rahmens

Exch<- read.table("Husjp00.dat",header=T)
attach(Exch)
Time<- 1:1063     # Werte des 1063 x 1 Datenvektors Time
length(USJP); mean(USJP); sqrt(var(USJP))

postscript(file="USJP.ps",height=15,width=10,horizontal=F)
par(mfrow=c(2,1))

plot(Time,USJP,type="l",lty=1,xlim=c(0,1063),ylim=c(100,135),
   xlab="Day, 3rd Jan 2000 - 26th Mar 2004",ylab="US-JP Exchange Rate",cex=0.85)
title(main="US Dollar-JP Yen, Daily Exchange Rate",cex=0.85) 
text(0,92.5,"2000",cex=0.85); text(1000,92.5,"2004",cex=0.85)
text(250,92.5,"2001",cex=0.85); text(500,92.5,"2002",cex=0.85)
text(750,92.5,"2003",cex=0.85)

USJPt<- USJP[2:1063]; USJPtm<- USJP[1:1062]
USJPDif<-  USJPt - USJPtm
mean(USJPDif); sqrt(var(USJPDif))

plot(Time[1:1062],USJPDif,type="l",lty=1,xlim=c(0,1062),ylim=c(-3,3),
xlab="Day, 3rd Jan 2000-26th Mar 2004",ylab="US-JP Exchange Rate, Diff",
   cex=0.85)
abline(h=0,lty=2)
text(0,-4.3,"2000",cex=0.85); text(1000,-4.3,"2004",cex=0.85)
text(250,-4.3,"2001",cex=0.85); text(500,-4.3,"2002",cex=0.85)
text(750,-4.3,"2003",cex=0.85)

USJPRet<-  USJPDif/USJPtm
mean(USJPRet); sqrt(var(USJPRet))

detach(Exch)
dev.off()
rm(USJPt,USJPtm,USJPDif,USJPRet,Time,Exch)