Statistics 4M03 / 6M03 - Assignment #1

1998-09-24

Due: 1998-10-05


Do the following problems from Chapter 1 of Johnson & Wichern, Applied Multivariate Statistical Analysis, 4th edition. Use Splus wherever you can to do the calculations and plot graphs.

1.4, 1.5, 1.7, 1.8, 1.9, 1.19, 1.20, 1.23.



NOTES:

There is a typo in the disk version of T11.9; be sure to correct it before you attempt to read the file into Splus!


In 1.23 you are asked to draw a stars plot. There is a bug in stars() in Splus 5.0 Release 1 but you can fix it.

If you try to use stars() you get the error message

Object "labels ..." not found

Look at the code for stars():

> stars
function(x, ..., labels)
{
        if(!missing(labels) || length(labels <- dimnames(x)[[1]]) > 0) {
                .Begin.pic()
                .Cur.pic(.Internal(stars("zstars", x, labels = labels ...),
                        "call_S_Version2"))
        }
        else {
                .Begin.pic()
                .Cur.pic(.Internal(stars("zstars", x, ...), "call_S_Version2"))
        }
}

Obviously there isn't supposed to be an object called "labels ...", it just looks that way because there is a comma missing in the fifth line of the function: "labels = labels ..." should be "labels = labels, ..."

Make a copy of stars in your own directory and edit it to correct the error. After that, calls you make to stars() will use your corrected function instead of the original stars.

> stars <- stars
> fix(stars)
.
.
.
> stars
function(x, ..., labels)
{
        if(!missing(labels) || length(labels <- dimnames(x)[[1]]) > 0) {
                .Begin.pic()
                .Cur.pic(.Internal(stars("zstars", x, labels = labels, ...),
                        "call_S_Version2"))
        }
        else {
                .Begin.pic()
                .Cur.pic(.Internal(stars("zstars", x, ...), "call_S_Version2"))
        }
}


If the text is too big on a plot, reduce it with the "character expansion factor", for example, to reduce character size by 50%, put cex = 0.5 or par(cex = 0.5) in the argument list when you call the plotting function.


The plotting functions stars(), faces() and spin() operate on matrices, not data frames.


Back to Statistics 4M03/6M03