S-Plus Code for "Statistics and Finance: An Introduction" by David Ruppert (Springer-Verlag, 2004).

Download .zip Download .tar.gz View on GitHub

Note: This is an old project and is no longer being maintained. There is a more current version of Ruppert's text; I don't know how much of this material applies to that version. (And who still uses S-Plus?) I am providing this archive for historical reasons only.


This archive contains S-Plus translations of all the SAS and MATLAB code that is used in David Ruppert's text, "Statistics and Finance: an Introduction" (Springer-Verlag, 2004). It is provided as a convenience to students using the text.


There is a directory named "chapterXX" for each chapter. Each such directory contains all the code needed to replicate the figures and examples in that chapter. Each code file (with extension ".q") is named according to whether it generates a figure (e.g., "figure4-1.q" generates Figure 4.1) or replicates an example (e.g., "page410.q" contains a translation of the code on or around page 410). In addition, each directory also contains a ".First.q" file. This file loads any auxiliary functions needed for that chapter, and should be run before running any of the code for that chapter.

Chapters 1 and 14 do not contain code or figures, hence they do not have directories.

The directory "common" contains auxiliary functions used throughout the book. It also contains a subdirectory, "data" that contains all the data sets for the book. Most of these data sets come from Ruppert's web site, but I managed to track down a few data sets that Ruppert did not provide (e.g., the Pindyck and Rubinfeld data set used in Chapter 12).


I have written this code with the student in mind. I have tried to use basic S-Plus commands wherever possible; for example, I have avoided using the more efficient "apply" commands in favor of more straightforward "for" loops. I have also tried to explain the trickier parts of the code in my comments. Hopefully everything is fairly clear.

S-Plus, MATLAB, and SAS are all very different computational packages. I've taken great pains to make S-Plus figures look like MATLAB figures. In a few places I've provided code that replicates SAS's output exactly for illustrative purposes, while in other places I simply showed how to calculate the statistics needed and nothing more.


All of the code was developed on a Pentium IV machine running Windows XP SP2 with S-Plus 6.2. I have not verified that the code works as described under any other architecture, operating system, or version of S-Plus (or R). I provide this code without any warranties or guarantees. By using this code you agree not to hold me responsible for any damage to your computer this code may cause.




Send any comments, suggestions, or questions you may have to me (cggreen AT uw DOT edu).