# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- set.seed(66) require(graphics) # gets all of the data: data = read.csv("GE_20100102_20100604.csv",head=TRUE,sep=",") # get the log of the closing prices: lcp = log( data[,5] ) #lcp = log( data[,7] ) npts = length(lcp) postscript(file="../../WriteUp/Graphics/Chapter2/fig_2_6_a.eps", onefile=FALSE, horizontal=FALSE) plot( 1:npts, lcp, 'o', main="GE Series", xlab="index",ylab="log(closing price)") dev.off() # take the difference: dlcp = diff(lcp) postscript(file="../../WriteUp/Graphics/Chapter2/fig_2_6_b.eps", onefile=FALSE, horizontal=FALSE) plot( 1:length(dlcp), dlcp, 'o', main="GE rate of return", xlab="index",ylab="returns") dev.off() # plot a QQ plot of these returns: postscript(file="../../WriteUp/Graphics/Chapter2/fig_2_6_c.eps", onefile=FALSE, horizontal=FALSE) qqnorm(dlcp) qqline(dlcp) dev.off() # plot the autocorrelation function: postscript(file="../../WriteUp/Graphics/Chapter2/fig_2_6_d.eps", onefile=FALSE, horizontal=FALSE) acf(dlcp) dev.off()