Data Analysis Project 2

Step 2 Exploratory Data Analysis

George Fisher george@georgefisher.com

Observations


Plot Max Acceleration for X, Y, Z axes: for training data

str(train[10:12])
## 'data.frame':    1315 obs. of  3 variables:
##  $ tBodyAcc-max()-X: num  -0.935 -0.943 -0.939 -0.939 -0.942 ...
##  $ tBodyAcc-max()-Y: num  -0.567 -0.558 -0.558 -0.576 -0.569 ...
##  $ tBodyAcc-max()-Z: num  -0.744 -0.818 -0.818 -0.83 -0.825 ...
par(mfrow = c(1, 3))
plot(train[, 10], main = "X-Axis", pch = 19, col = numericActivity.train, ylab = names(train)[10], 
    xlab = "observations")
abline(h = 0)

plot(train[, 11], main = "Y-Axis", sub = "Standing, Sitting, Laying: lower", 
    cex.sub = 1.4, pch = 19, col = numericActivity.train, ylab = names(train)[11], 
    xlab = "")
abline(h = 0)
mtext("Max Accel Data", col = "red")

plot(train[, 12], main = "Z-Axis", pch = 19, col = numericActivity.train, ylab = names(train)[12], 
    xlab = "observations")
abline(h = 0)

legend(160, 0.4, legend = unique(train$activity), col = unique(numericActivity.train), 
    pch = 19)

plot of chunk s2_plot.max.accel


Cluster Based on Max Acceleration Data

distanceMatrix <- dist(train[, 10:12], method = "euclidean")
hclustering <- hclust(distanceMatrix)
myplclust(hclustering, lab.col = numericActivity.train, main = "Hierarchical Clustering Dendogram of X, Y, Z max acceleration data\nStanding, Sitting, Laying (left, browns) distinguishable from\nWalking, Walkup, Walkdown (right, blues)")

plot of chunk s2.initial.cluster


Info about the system running this code

print(str(.Platform))
## List of 8
##  $ OS.type   : chr "windows"
##  $ file.sep  : chr "/"
##  $ dynlib.ext: chr ".dll"
##  $ GUI       : chr "RTerm"
##  $ endian    : chr "little"
##  $ pkgType   : chr "win.binary"
##  $ path.sep  : chr ";"
##  $ r_arch    : chr "x64"
## NULL
print(version)
##                _                           
## platform       x86_64-w64-mingw32          
## arch           x86_64                      
## os             mingw32                     
## system         x86_64, mingw32             
## status                                     
## major          3                           
## minor          0.2                         
## year           2013                        
## month          09                          
## day            25                          
## svn rev        63987                       
## language       R                           
## version.string R version 3.0.2 (2013-09-25)
## nickname       Frisbee Sailing
print(sessionInfo(), locale = FALSE)
## R version 3.0.2 (2013-09-25)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] knitr_1.5
## 
## loaded via a namespace (and not attached):
## [1] evaluate_0.5.1 formatR_0.10   stringr_0.6.2  tools_3.0.2
print(Sys.time())
## [1] "2013-12-07 14:55:23 EST"