Notes Regarding the Use of WRDS and the creation of an S-Plus Finmetrics Time Series This file tells you how to (1) Access WRDS and download data as a text file (2) convert the text file to an S-Plus object of type data.frame (3) Convert the S-Plus data.frame object to an object of type timeSeries This three step process seems like a pain, but it's really not so bad. The good part is at the end of this drill you get to analyze some real data that matters to many people. =================================================================================== Note: if you find a typo --- or suspect a typo --- send me e-mail =================================================================================== WRDS wrds1.wharton.upenn.edu members login CRSP Annual Up-dates:Daily Stocks IBM Holding Period Returns (look at the hyper-doc while you are here!) Follow instuctions to download the file and save it as ibm.txt (perhaps to your desktop, though later you will want to have a special WRDs Downloads File) Note: Non-Wharton Students will need to get a Wharton Class Account. Instuctions for doing this are posted in a like under e-Handouts. ================================================================================== S-Plus File/Import ... Use this to create an R data.frame called ibm from the file ibm.txt Use the GUI data editor to 1. Remove the fluff at the top 2. Delete the name tag column 2. Change the (new) first column to type character (using "Change Data Type in the right-click menu provided by the GUI) 3. Change the (new) second column to type double (again using "Change Data Type") These steps give you an object of type data.frame which can be made into an object of type timeSeries that is appropriate for the Finmetrics tools. ================================================================================= Finmetrics module(finmetrics) ibm.td<-timeDate(ibm[,1], in.format="%4Y%2m%2d") ibm.ts<-timeSeries(data<-ibm[,2], pos<-ibm.td) Note: Z&W pages 19--31 have more than you want to know about timeDate, but most people just look at the examples given by format.timeDate (as discussed on p.19) ================================================================================ Test Drive --- with a message --- and useful for HW3 plot(ibm.ts) autocorTest(ibm.ts) qqnorm(ibm.ts) temp<-rt(df=5, length(ibm.ts)) qqplot(seriesData(ibm.ts), temp) normalTest(seriesData(ibm.ts)) normalTest(temp) temp2<-rnorm(100) normalTest(temp2) ================================================================================