Cars {rrcov} | R Documentation |
Consumer reports car data: dimensions
Description
A data frame containing 11 variables with different dimensions of 111 cars
Usage
data(Cars)
Format
A data frame with 111 observations on the following 11 variables.
length
a numeric vector
wheelbase
a numeric vector
width
a numeric vector
height
a numeric vector
front.hd
a numeric vector
rear.hd
a numeric vector
front.leg
a numeric vector
rear.seating
a numeric vector
front.shoulder
a numeric vector
rear.shoulder
a numeric vector
luggage
a numeric vector
Source
Consumer reports. (April 1990). http://backissues.com/issue/Consumer-Reports-April-1990, pp. 235–288.
References
Chambers, J. M. and Hastie, T. J. (1992). Statistical models in S. Cole, Pacific Grove, CA: Wadsworth and Brooks, pp. 46–47.
M. Hubert, P. J. Rousseeuw, K. Vanden Branden (2005), ROBPCA: A new approach to robust principal components analysis, Technometrics, 47, 64–79.
Examples
data(Cars)
## Plot a pairwise scaterplot matrix
pairs(Cars[,1:6])
mcd <- CovMcd(Cars[,1:6])
plot(mcd, which="pairs")
## Start with robust PCA
pca <- PcaHubert(Cars, k=ncol(Cars), kmax=ncol(Cars))
pca
## Compare with the classical PCA
prcomp(Cars)
## or
PcaClassic(Cars, k=ncol(Cars), kmax=ncol(Cars))
## If you want to print the scores too, use
print(pca, print.x=TRUE)
## Using the formula interface
PcaHubert(~., data=Cars, k=ncol(Cars), kmax=ncol(Cars))
## To plot the results:
plot(pca) # distance plot
pca2 <- PcaHubert(Cars, k=4)
plot(pca2) # PCA diagnostic plot (or outlier map)
## Use the standard plots available for prcomp and princomp
screeplot(pca) # it is interesting with all variables
biplot(pca) # for biplot we need more than one PCs
## Restore the covraiance matrix
py <- PcaHubert(Cars, k=ncol(Cars), kmax=ncol(Cars))
cov.1 <- py@loadings %*% diag(py@eigenvalues) %*% t(py@loadings)
cov.1
[Package rrcov version 1.7-5 Index]