tem<-read.table('msft9303tm2.dat', col.names=c('p2','t2')) attach(tem) rn2<-length(t2) p3<-p2[2:rn2]-p2[1:rn2-1] t3<-rep(0,rn2) t3[1]<-t2[1] t21<-t2[2:rn2] t22<-t2[1:rn2-1] t3[2:rn2]<-t21-t22 ytnn<-cbind(p2,t3) write.table(ytnn,"msft9303tmdf.dat",sep=",") postscript("msft9303tm.ps", he=6,wi=10, ho=T,pointsize=18) par(las=1,mar=c(3.1,3.2,3,1.3),mgp=c(2.1,0.5,0)) day<-t2/23400 price<-p2 plot(day,price,type="l") title("Tick Data of MSFT in March, 1993") graphics.off() postscript("msft9303tm1.ps", he=6,wi=10, ho=T,pointsize=18) par(las=1,mar=c(3.1,3.2,3,1.3),mgp=c(2.1,0.5,0)) hist(t3,breaks=c(-0.001,4,10,20,40,60,80,100,120,140,160,180,200,250,300,450), probability=T,main=NULL, xlab=c("Duration"),col="lightblue") x<-c(0,2,7,15,30,50,70,90,110,130,150,170,190,225,275,350,450) y<-(1/16.57519)*exp(-x/16.57519) lines(x,y,type="l",lty=1) title("Density Plot of intertrade-occurance time") graphics.off() postscript("msft9303tm2.ps",he=11,wi=6, horizontal=F,pointsize=10) par(las=1,mar=c(3.1,3.2,3,1.3),mgp=c(2.1,0.5,0)) par(mfrow=c(2,1)) fp<-p2-floor(p2) hist(p3, main=NULL, col="lightblue", xlab=c("price change")) title("Distribution of Successive Price Changes of MSFT") hist(fp, main=NULL, col="lightblue", xlab=c("fractional part of price")) title("Histogram of of Fractional Part of MSFT") graphics.off() rm(list=ls())