
Stat 5600 — Applied Multivariate Statistics
Homework 4
Principal Components Analysis
Due Thursday, February 15
1. The RECORDS dataset may be found on the website. This includes athletic records
for 55 countries in each of 8 track and field events. Read this data into R and use the
prcomp command to answer question 4.8.
2. Examine the first two principal components of the records data with a scatterplot.
Do you observe any unusual structure? Use the text or identify command (with
labels = rownames(X) ) to identify any outliers you observe. Compare the values of
the outliers in the original variables to the means of those variables. Explain why the
outliers are unusual.
3. The COGNITION dataset may be found on the website. This dataset represents 18
survey questions designed to measure “need for cognition.” See p. 87 for more detail.
This dataset has some missing values, indicated by periods. The observations with
missing values should be removed for the principal components analysis. This can be
achieved with commands such as:
Cog <- read.table(‘‘filename’’, na.strings=‘‘.’’)
Cog2 <- na.omit(Cog)
and then conducting your analysis on Cog2. Use Cog2 and the prcomp command
(scale=T) to answer question 4.6.
4. Examine the scatterplot of the first two principal components of the cognition data.
Is there any interesting structure or obvious outliers?
5. The VOCATIONS file on the website contains the lower half of the correlation matrix
associated with a data matrix of male undergraduates’ interests in 22 vocational areas.
Copy the read.tri function below (which may also be found on the web site) into R,
and use it to read in the correlation matrix. (File is a path name, just as in source
or read.table.) Use the eigen command to conduct a PCA on this matrix (prcomp
requires the original data matrix), and answer question 4.7.
6. The DRUG USE dataset is a similar correlation matrix among young teens for usage
of 13 different classes of drugs. Use read.tri and eigen to answer question 4.9.
read.tri <- function(file)
{x <- scan(file)
lx <- length(x)
d <- (sqrt(8*lx+1)-1)/2
m <- matrix(0, d, d)
m[upper.tri(m, T)] <- x
m <- m + t(m) - diag(diag(m))
return(m)}