Description Usage Format Details Source References Examples
U.S. Crime rates per 100,00 people for 7 categories in each of the 50 U.S. states in 1977.
1 |
A data frame with 50 observations on the following 8 variables.
U.S. state
murders
rapes
robbery
assault
burglary
larceny
automobile thefts
There are two missing values.
Documentation Example 3 for PROC HPPRINCOMP. http://documentation.sas.com/api/docsets/stathpug/14.2/content/stathpug_code_hppriex3.htm?locale=en
SAS/STAT User's Guide: High-Performance Procedures. The HPPRINCOMP Procedure. http://support.sas.com/documentation/cdl/en/stathpug/67524/HTML/default/viewer.htm#stathpug_hpprincomp_toc.htm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(nipals)
head(uscrime)
# SAS deletes rows with missing values
dat <- uscrime[complete.cases(uscrime), ]
dat <- as.matrix(dat[ , -1])
m1 <- nipals(dat) # complete-data method
# Traditional NIPALS with missing data
dat <- uscrime
dat <- as.matrix(dat[ , -1])
m2 <- nipals(dat, gramschmidt=FALSE) # missing
round(crossprod(m2$loadings),3) # Prin Comps not quite orthogonal
# Gram-Schmidt corrected NIPALS
m3 <- nipals(dat, gramschmidt=TRUE) # TRUE is default
round(crossprod(m3$loadings),3) # Prin Comps are orthogonal
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.