Page 21 - Computational Statistics Handbook with MATLAB
P. 21
6 Computational Statistics Handbook with MATLAB
1.3 MATLAB Code
Along with the algorithmic explanation of the procedures, we include
MATLAB commands to show how they are implemented. Any MATLAB
commands, functions or data sets are in courier bold font. For example, plot
denotes the MATLAB plotting function. The commands that are in the exam-
ples can be typed in at the command line to execute the examples. However,
we note that due to typesetting considerations, we often have to continue a
MATLAB command using the continuation punctuation (...). However,
users do not have to include that with their implementations of the algo-
rithms. See Appendix A for more information on how this punctuation is
used in MATLAB.
Since this is a book about computational statistics, we assume the reader
has the MATLAB Statistics Toolbox. In Appendix E, we include a list of func-
tions that are in the toolbox and try to note in the text what functions are part
of the main MATLAB software package and what functions are available
only in the Statistics Toolbox.
The choice of MATLAB for implementation of the methods is due to the fol-
lowing reasons:
• The commands, functions and arguments in MATLAB are not cryp-
tic. It is important to have a programming language that is easy to
understand and intuitive, since we include the programs to help
teach the concepts.
• It is used extensively by scientists and engineers.
• Student versions are available.
• It is easy to write programs in MATLAB.
• The source code or M-files can be viewed, so users can learn about
the algorithms and their implementation.
• User-written MATLAB programs are freely available.
• The graphics capabilities are excellent.
It is important to note that the MATLAB code given in the body of the book
is for learning purposes. In many cases, it is not the most efficient way to pro-
gram the algorithm. One of the purposes of including the MATLAB code is
to help the reader understand the algorithms, especially how to implement
them. So, we try to have the code match the procedures and to stay away
from cryptic programming constructs. For example, we use for loops at
times (when unnecessary!) to match the procedure. We make no claims that
our code is the best way or the only way to program the algorithms.
In some cases, the MATLAB code is contained in an appendix, rather than
in the corresponding chapter. These are applications where the MATLAB
© 2002 by Chapman & Hall/CRC