README.md

================================================================== Human Activity Recognition Using Smartphones Dataset

Explanation of the analysis files (analysedData.txt)

by: Suparna Sen

Experiment briefing as given:

The experiments have been carried out with a group of 30 volunteers within an age bracket of 19-48 years. Each person performed six activities (WALKING, WALKING_UPSTAIRS, WALKING_DOWNSTAIRS, SITTING, STANDING, LAYING) wearing a smartphone (Samsung Galaxy S II) on the waist. Using its embedded accelerometer and gyroscope, we captured 3-axial linear acceleration and 3-axial angular velocity at a constant rate of 50Hz. The experiments have been video-recorded to label the data manually. The obtained dataset has been randomly partitioned into two sets, where 70% of the volunteers was selected for generating the training data and 30% the test data.

The sensor signals (accelerometer and gyroscope) were pre-processed by applying noise filters and then sampled in fixed-width sliding windows of 2.56 sec and 50% overlap (128 readings/window). The sensor acceleration signal, which has gravitational and body motion components, was separated using a Butterworth low-pass filter into body acceleration and gravity. The gravitational force is assumed to have only low frequency components, therefore a filter with 0.3 Hz cutoff frequency was used. From each window, a vector of features was obtained by calculating variables from the time and frequency domain.

The relevant files from the given dataset:

The dimensions of the given relevant datasets:

Requirement for the final analysed data:

Average/mean in standard units of each variable for each activity and each subject.

Steps taken to derive the final output 'analysedData.txt'

  1. Downloaded the data in respective data frames as mentioned above.
  2. Added a new column to 'trainActID.df' and 'testActID.df' from 'actLabels.df' to give activity descriptions to the given activity code
  3. 561 columns in both 'trainData.df' and 'testData.df' were named from 561 rows in 'feature.df'
  4. Data cleaning variable names with descriptive variable names was done for both 'trainData.df' and 'testData.df'
  5. Subject id and activity description was added to both 'trainData.df' and 'testData.df' from updated 'trainActID.df' and 'testActID.df' respectively
  6. Merging the data from modified 'trainData.df' and 'testData.df' to 'MERGED_DATA'
  7. Extracted only the measurements on the mean(): Mean value & std(): Standard deviation for each measurement [avoiding meanFreq] to create data frames 'req_data_mean' and 'req_data_std' respectively.
  8. From the data sets created in step 7, created two more, independent tidy data sets with the average of each variable for each activity and each subject, named 'meanDcast' and 'stdDcast' respectively.
  9. Further cleaned the variable names in both 'meanDcast' and 'stdDcast' to get rid of '(' and ')'.
  10. Merged 'meanDcast' and 'stdDcast' into 'final.df'.
  11. Stored 'final.df' into 'analysedData.txt'.

The set of variables in 'analysedData.txt', data type and indicative values were averaged from given signals are:

'data.frame':   180 obs. of  68 variables:
 $ ACTDESC                                    : chr  "LAYING" "LAYING" "LAYING" "LAYING" ...
 $ SUBJID                                     : int  1 10 11 12 13 14 15 16 17 18 ...
 $ timeBodyAccelerometerMeanXaxis             : num  0.222 0.28 0.281 0.26 0.277 ...
 $ timeBodyAccelerometerMeanYaxis             : num  -0.0405 -0.0243 -0.0177 -0.0175 -0.0204 ...
 $ timeBodyAccelerometerMeanZaxis             : num  -0.113 -0.117 -0.109 -0.108 -0.104 ...
 $ timeGravityAccelerometerMeanXaxis          : num  -0.249 -0.453 -0.135 -0.379 -0.157 ...
 $ timeGravityAccelerometerMeanYaxis          : num  0.706 -0.139 0.943 0.803 0.656 ...
 $ timeGravityAccelerometerMeanZaxis          : num  0.4458 -0.0311 0.1126 0.275 0.5989 ...
 $ timeBodyAccelerometerJerkMeanXaxis         : num  0.0811 0.0738 0.0767 0.0854 0.0768 ...
 $ timeBodyAccelerometerJerkMeanYaxis         : num  0.00384 0.0157 0.01222 0.00774 0.01834 ...
 $ timeBodyAccelerometerJerkMeanZaxis         : num  0.01083 0.00717 0.00278 -0.00437 -0.00988 ...
 $ timeBodyGyroscopeMeanXaxis                 : num  -0.01655 -0.01956 -0.01917 -0.01465 -0.00974 ...
 $ timeBodyGyroscopeMeanYaxis                 : num  -0.0645 -0.077 -0.0416 -0.0836 -0.0966 ...
 $ timeBodyGyroscopeMeanZaxis                 : num  0.149 0.105 0.152 0.145 0.118 ...
 $ timeBodyGyroscopeJerkMeanXaxis             : num  -0.107 -0.1 -0.102 -0.099 -0.102 ...
 $ timeBodyGyroscopeJerkMeanYaxis             : num  -0.0415 -0.0389 -0.0412 -0.0411 -0.0418 ...
 $ timeBodyGyroscopeJerkMeanZaxis             : num  -0.0741 -0.0591 -0.0667 -0.0679 -0.0649 ...
 $ timeBodyAccelerometerMagnitudeMean         : num  -0.842 -0.957 -0.981 -0.948 -0.961 ...
 $ timeGravityAccelerometerMagnitudeMean      : num  -0.842 -0.957 -0.981 -0.948 -0.961 ...
 $ timeBodyAccelerometerJerkMagnitudeMean     : num  -0.954 -0.976 -0.983 -0.97 -0.985 ...
 $ timeBodyGyroscopeMagnitudeMean             : num  -0.875 -0.938 -0.953 -0.931 -0.944 ...
 $ timeBodyGyroscopeJerkMagnitudeMean         : num  -0.963 -0.971 -0.991 -0.971 -0.985 ...
 $ frequencyBodyAccelerometerMeanXaxis        : num  -0.939 -0.969 -0.984 -0.956 -0.975 ...
 $ frequencyBodyAccelerometerMeanYaxis        : num  -0.867 -0.954 -0.971 -0.951 -0.966 ...
 $ frequencyBodyAccelerometerMeanZaxis        : num  -0.883 -0.964 -0.974 -0.955 -0.966 ...
 $ frequencyBodyAccelerometerJerkMeanXaxis    : num  -0.957 -0.979 -0.985 -0.969 -0.985 ...
 $ frequencyBodyAccelerometerJerkMeanYaxis    : num  -0.922 -0.968 -0.974 -0.963 -0.98 ...
 $ frequencyBodyAccelerometerJerkMeanZaxis    : num  -0.948 -0.973 -0.98 -0.967 -0.981 ...
 $ frequencyBodyGyroscopeMeanXaxis            : num  -0.85 -0.954 -0.976 -0.957 -0.969 ...
 $ frequencyBodyGyroscopeMeanYaxis            : num  -0.952 -0.955 -0.983 -0.953 -0.969 ...
 $ frequencyBodyGyroscopeMeanZaxis            : num  -0.909 -0.97 -0.961 -0.946 -0.969 ...
 $ frequencyBodyAccelerometerMagnitudeMean    : num  -0.862 -0.951 -0.974 -0.944 -0.96 ...
 $ frequencyBodyAccelerometerJerkMagnitudeMean: num  -0.933 -0.969 -0.977 -0.962 -0.981 ...
 $ frequencyBodyGyroscopeMagnitudeMean        : num  -0.862 -0.938 -0.967 -0.945 -0.958 ...
 $ frequencyBodyGyroscopeJerkMagnitudeMean    : num  -0.942 -0.961 -0.986 -0.964 -0.978 ...
 $ timeBodyAccelerometerStdXaxis              : num  -0.928 -0.968 -0.985 -0.955 -0.969 ...
 $ timeBodyAccelerometerStdYaxis              : num  -0.837 -0.946 -0.972 -0.949 -0.951 ...
 $ timeBodyAccelerometerStdZaxis              : num  -0.826 -0.959 -0.971 -0.948 -0.95 ...
 $ timeGravityAccelerometerStdXaxis           : num  -0.897 -0.955 -0.98 -0.936 -0.958 ...
 $ timeGravityAccelerometerStdYaxis           : num  -0.908 -0.967 -0.991 -0.974 -0.976 ...
 $ timeGravityAccelerometerStdZaxis           : num  -0.852 -0.963 -0.984 -0.96 -0.96 ...
 $ timeBodyAccelerometerJerkStdXaxis          : num  -0.958 -0.978 -0.985 -0.969 -0.985 ...
 $ timeBodyAccelerometerJerkStdYaxis          : num  -0.924 -0.967 -0.973 -0.963 -0.98 ...
 $ timeBodyAccelerometerJerkStdZaxis          : num  -0.955 -0.976 -0.982 -0.971 -0.983 ...
 $ timeBodyGyroscopeStdXaxis                  : num  -0.874 -0.962 -0.981 -0.966 -0.972 ...
 $ timeBodyGyroscopeStdYaxis                  : num  -0.951 -0.954 -0.982 -0.954 -0.963 ...
 $ timeBodyGyroscopeStdZaxis                  : num  -0.908 -0.972 -0.96 -0.95 -0.967 ...
 $ timeBodyGyroscopeJerkStdXaxis              : num  -0.919 -0.966 -0.982 -0.967 -0.981 ...
 $ timeBodyGyroscopeJerkStdYaxis              : num  -0.968 -0.967 -0.991 -0.966 -0.979 ...
 $ timeBodyGyroscopeJerkStdZaxis              : num  -0.958 -0.984 -0.987 -0.97 -0.99 ...
 $ timeBodyAccelerometerMagnitudeStd          : num  -0.795 -0.94 -0.973 -0.937 -0.948 ...
 $ timeGravityAccelerometerMagnitudeStd       : num  -0.795 -0.94 -0.973 -0.937 -0.948 ...
 $ timeBodyAccelerometerJerkMagnitudeStd      : num  -0.928 -0.968 -0.977 -0.963 -0.98 ...
 $ timeBodyGyroscopeMagnitudeStd              : num  -0.819 -0.927 -0.955 -0.936 -0.945 ...
 $ timeBodyGyroscopeJerkMagnitudeStd          : num  -0.936 -0.96 -0.984 -0.962 -0.975 ...
 $ frequencyBodyAccelerometerStdXaxis         : num  -0.924 -0.968 -0.985 -0.955 -0.967 ...
 $ frequencyBodyAccelerometerStdYaxis         : num  -0.834 -0.946 -0.974 -0.951 -0.947 ...
 $ frequencyBodyAccelerometerStdZaxis         : num  -0.813 -0.96 -0.972 -0.948 -0.946 ...
 $ frequencyBodyAccelerometerJerkStdXaxis     : num  -0.964 -0.979 -0.987 -0.973 -0.987 ...
 $ frequencyBodyAccelerometerJerkStdYaxis     : num  -0.932 -0.968 -0.973 -0.965 -0.981 ...
 $ frequencyBodyAccelerometerJerkStdZaxis     : num  -0.961 -0.979 -0.983 -0.973 -0.984 ...
 $ frequencyBodyGyroscopeStdXaxis             : num  -0.882 -0.965 -0.982 -0.969 -0.973 ...
 $ frequencyBodyGyroscopeStdYaxis             : num  -0.951 -0.953 -0.983 -0.955 -0.96 ...
 $ frequencyBodyGyroscopeStdZaxis             : num  -0.917 -0.975 -0.963 -0.956 -0.97 ...
 $ frequencyBodyAccelerometerMagnitudeStd     : num  -0.798 -0.944 -0.976 -0.942 -0.949 ...
 $ frequencyBodyAccelerometerJerkMagnitudeStd : num  -0.922 -0.965 -0.975 -0.962 -0.978 ...
 $ frequencyBodyGyroscopeMagnitudeStd         : num  -0.824 -0.934 -0.955 -0.94 -0.946 ...
 $ frequencyBodyGyroscopeJerkMagnitudeStd     : num  -0.933 -0.961 -0.984 -0.962 -0.973 ...


datascience122015/runAnalysis documentation built on May 14, 2019, 7:46 p.m.