Clarification of terminology

Jerk is the rate of change of acceleration

Acceleration is the rate of change of velocity

Gravity is the mass-proportionate force of attraction among matter

A gyroscope is defined as: A gyroscope (from Greek γῦρος gûros, “circle” and σκοπέω skopéō, “to >look”) is a spinning wheel or disc in which the axis of rotation is free to assume any orientation. When rotating, the orientation of this axis is unaffected by tilting or rotation of the mounting, according to the conservation of angular momentum. Because of this, gyroscopes are useful for measuring or maintaining orientation.

The signals measured during the experiment were used to estimate variables of the feature vector for each pattern:

The variables given in the raw test and train data sets (.txt files) are named as follows:

    +t/fBodyAcc-XYZ
    +tGravityAcc-XYZ
    +t/fBodyAccJerk-XYZ
    +t/fBodyGyro-XYZ
    +tBodyGyroJerk-XYZ
    +t/fBodyAccMag
    +tGravityAccMag
    +t/fBodyAccJerkMag
    +t/fBodyGyroMag
    +t/fBodyGyroJerkMag

“t” and “f” denote the domains of the signals, with “t” referring to “time” and “f” referring to “frequency”, respectively.

‘-XYZ’ denotes 3-axial signals in the X, Y and Z directions.

The complete list of variables estimated from the signals that appear in the raw data sets and are documented in the documentation accompanying the raw data is:

    +mean(): Mean value
    +std(): Standard deviation
    +mad(): Median absolute deviation 
    +max(): Largest value in array
    +min(): Smallest value in array
    +sma(): Signal magnitude area
    +energy(): Energy measure. Sum of the squares divided by the number of values. 
    +iqr(): Interquartile range 
    +entropy(): Signal entropy
    +arCoeff(): Autorregresion coefficients with Burg order equal to 4
    +correlation(): correlation coefficient between two signals
    +maxInds(): index of the frequency component with largest magnitude
    +meanFreq(): Weighted average of the frequency components to obtain a mean frequency
    +skewness(): skewness of the frequency domain signal 
    +kurtosis(): kurtosis of the frequency domain signal 
    +bandsEnergy(): Energy of a frequency interval within the 64 bins of the FFT of each window.
    +angle(): Angle between to vectors.

From these variables, only the mean (indicated as “mean()”) and standard deviation (indicated as “std()”) variables are extracted in the run_analysis.R script.

Further modifications to nomenclature

In the run_analysis.R script, variable names as given by the raw data documentation are modified for ease of “human-readability”.

“BodyBody” does not appear in the information about the variables provided and was thus assumed to be an error.

Structural changes: * The use of camel case: capitilisation of the first letter of each individual word within the variable names * for ease of differentiation between different words within the name string.

e.g.“FBodyGyroscopeJerkMagnitudeStandardDeviation” indicates:

    +F
    +Body
    +Gyroscope
    +Jerk
    +Magnitude
    +Standard Deviation 
    

The data set contains activities performed by each subject during the experiment. The subject identification numbers in the data set are unique, taken from the raw data and the variable name is *“SubjectId”

The activities are variables in the run_analysis.R script and the variable name is “Activities”

The six (6) different activities that were performed while the data was captured are named as follows:

    +Laying (laying down)
    +Sitting (sitting upright)
    +Standing (no movement)
    +Walking (in a straight line)
    +WalkingDownstairs (walking down a flight of stairs)
    +WalkingUpstairs (walking up a flight of stairs)

code for codebook with descritions attached to variable names

VariablePrefixDescrip <- c("Activities", "SubjectId", "TBodyAccelerationMeanX", "TBodyAccelerationMeanY", "TBodyAccelerationMeanZ", "TBodyAccelerationStandardDeviationX", "TBodyAccelerationStandardDeviationY", "TBodyAccelerationStandardDeviationZ", "TGravityAccelerationMeanX", "TGravityAccelerationMeanY", "TGravityAccelerationMeanZ", "TGravityAccelerationStandardDeviationX", "TGravityAccelerationStandardDeviationY", "TGravityAccelerationStandardDeviationZ", "TBodyAccelerationJerkMeanX", "TBodyAccelerationJerkMeanY", "TBodyAccelerationJerkMeanZ", "TBodyAccelerationJerkStandardDeviationX", "TBodyAccelerationJerkStandardDeviationY", "TBodyAccelerationJerkStandardDeviationZ", "TBodyGyroscopeMeanX", "TBodyGyroscopeMeanY", "TBodyGyroscopeMeanZ", "TBodyGyroscopeStandardDeviationX", "TBodyGyroscopeStandardDeviationY", "TBodyGyroscopeStandardDeviationZ", "TBodyGyroscopeJerkMeanX", "TBodyGyroscopeJerkMeanY", "TBodyGyroscopeJerkMeanZ", "TBodyGyroscopeJerkStandardDeviationX", "TBodyGyroscopeJerkStandardDeviationY", "TBodyGyroscopeJerkStandardDeviationZ", "TBodyAccelerationMagnitudeMean", "TBodyAccelerationMagnitudeStandardDeviation", "TGravityAccelerationMagnitudeMean", "TGravityAccelerationMagnitudeStandardDeviation", "TBodyAccelerationJerkMagnitudeMean", "TBodyAccelerationJerkMagnitudeStandardDeviation", "TBodyGyroscopeMagnitudeMean", "TBodyGyroscopeMagnitudeStandardDeviation", "TBodyGyroscopeJerkMagnitudeMean", "TBodyGyroscopeJerkMagnitudeStandardDeviation", "FBodyAccelerationMeanX", "FBodyAccelerationMeanY", "FBodyAccelerationMeanZ", "FBodyAccelerationStandardDeviationX", "FBodyAccelerationStandardDeviationY", "FBodyAccelerationStandardDeviationZ", "FBodyAccelerationJerkMeanX", "FBodyAccelerationJerkMeanY", "FBodyAccelerationJerkMeanZ", "FBodyAccelerationJerkStandardDeviationX", "FBodyAccelerationJerkStandardDeviationY", "FBodyAccelerationJerkStandardDeviationZ", "FBodyGyroscopeMeanX", "FBodyGyroscopeMeanY", "FBodyGyroscopeMeanZ", "FBodyGyroscopeStandardDeviationX", "FBodyGyroscopeStandardDeviationY", "FBodyGyroscopeStandardDeviationZ", "FBodyAccelerationMagnitudeMean", "FBodyAccelerationMagnitudeStandardDeviation", "FBodyAccelerationJerkMagnitudeMean", "FBodyAccelerationJerkMagnitudeStandardDeviation", "FBodyGyroscopeMagnitudeMean", "FBodyGyroscopeMagnitudeStandardDeviation", "FBodyGyroscopeJerkMagnitudeMean", "FBodyGyroscopeJerkMagnitudeStandardDeviation")
explanation <- VariablePrefixDescrip

explanation <- gsub("Activities", "The activity that was performed by the subject while the measurements were taken", explanation)

explanation <- gsub("SubjectId", "The unique identity number assigned to subject who took part in the experiment", explanation)

explanation <- gsub("TBodyAccelerationMeanX", "The mean of the acceleration of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyAccelerationMeanY", "The mean of the acceleration of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyAccelerationMeanZ", "The mean of the acceleration of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyAccelerationStandardDeviationX", "The standard deviation of the acceleration of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyAccelerationStandardDeviationY", "The standard deviation of the acceleration of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyAccelerationStandardDeviationZ", "The standard deviation of the acceleration of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TGravityAccelerationMeanX", "The mean of the acceleration in gravity in the X direction in time", explanation)
explanation <- gsub("TGravityAccelerationMeanY", "The mean of the acceleration in gravity in the Y direction in time", explanation)
explanation <- gsub("TGravityAccelerationMeanZ", "The mean of the acceleration in gravity in the Z direction in time", explanation)

explanation <- gsub("TGravityAccelerationStandardDeviationX", "The standard deviation of the acceleration in gravity in the X direction in time", explanation)
explanation <- gsub("TGravityAccelerationStandardDeviationY", "The standard deviation of the acceleration in gravity in the Y direction in time", explanation)
explanation <- gsub("TGravityAccelerationStandardDeviationZ", "The standard deviation of the acceleration in gravity in the Z direction in time", explanation)

explanation <- gsub("TBodyAccelerationJerkMeanX", "The mean of the jerk in acceleration of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyAccelerationJerkMeanY", "The mean of the jerk in acceleration of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyAccelerationJerkMeanZ", "The mean of the jerk in acceleration of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyAccelerationJerkStandardDeviationX", "The standard deviation of the jerk in acceleration of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyAccelerationJerkStandardDeviationY", "The standard deviation of the jerk in acceleration of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyAccelerationJerkStandardDeviationZ", "The standard deviation of the jerk in acceleration of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyGyroscopeMeanX", "The mean of the gyroscope measurement of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyGyroscopeMeanY", "The mean of the gyroscope measurement of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyGyroscopeMeanZ", "The mean of the gyroscope measurement of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyGyroscopeStandardDeviationX", "The standard deviation of the gyroscope measurement of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyGyroscopeStandardDeviationY", "The standard deviation of the gyroscope measurement of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyGyroscopeStandardDeviationZ", "The standard deviation of the gyroscope measurement of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyGyroscopeJerkMeanX", "The mean of the jerk of the gyroscope measurement of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyGyroscopeJerkMeanY", "The mean of the jerk of the gyroscope measurement of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyGyroscopeJerkMeanZ", "The mean of the jerk of the gyroscope measurement of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyGyroscopeJerkStandardDeviationX", "The standard deviation of the jerk of the gyroscope measurement of the subject's body in the X direction in time", explanation)
explanation <- gsub("TBodyGyroscopeJerkStandardDeviationY", "The standard deviation of the jerk of the gyroscope measurement of the subject's body in the Y direction in time", explanation)
explanation <- gsub("TBodyGyroscopeJerkStandardDeviationZ", "The standard deviation of the jerk of the gyroscope measurement of the subject's body in the Z direction in time", explanation)

explanation <- gsub("TBodyAccelerationMagnitudeMean", "The mean of the magnitude of the acceleration of the subject's body in time", explanation)
explanation <- gsub("TBodyAccelerationMagnitudeStandardDeviation", "The standard deviation of the magnitude of the acceleration of the subject's body in time", explanation)

explanation <- gsub("TGravityAccelerationMagnitudeMean", "The mean of the magnitude of the gravity measurement in time", explanation)
explanation <- gsub("TGravityAccelerationMagnitudeStandardDeviation", "The standard deviation of the magnitude of the gravity measurement in time", explanation)

explanation <- gsub("TBodyAccelerationJerkMagnitudeMean", "The mean of the magnitude of the jerk of the acceleration of the subject's body in time", explanation)
explanation <- gsub("TBodyAccelerationJerkMagnitudeStandardDeviation", "The standard deviation of the magnitude of the jerk of the acceleration of the subject's body in time", explanation)

explanation <- gsub("TBodyGyroscopeMagnitudeMean", "The mean of the magnitude of the gyroscope measurement on the subject's body in time", explanation)
explanation <- gsub("TBodyAccelerationMagnitudeStandardDeviation", "The standard deviation of the magnitude of the gyroscope measurement on the subject's body in time", explanation)

explanation <- gsub("TBodyGyroscopeJerkMagnitudeMean", "The mean of the magnitude of the jerk of the gyroscope measurement on the subject's body in time", explanation)
explanation <- gsub("TBodyAccelerationMagnitudeStandardDeviation", "The standard deviation of the magnitude of the jerk of the gyroscope measurement on the subject's body in time", explanation)

explanation <- gsub("FBodyAccelerationMeanX", "The mean of the acceleration of the subject's body in the X direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationMeanY", "The mean of the acceleration of the subject's body in the Y direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationMeanZ", "The mean of the acceleration of the subject's body in the Z direction in time", explanation)

explanation <- gsub("FBodyAccelerationStandardDeviationX", "The standard deviation of the acceleration of the subject's body in the X direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationStandardDeviationY", "The standard deviation of the acceleration of the subject's body in the Y direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationStandardDeviationZ", "The standard deviation of the acceleration of the subject's body in the Z direction in the frequency domain", explanation)

explanation <- gsub("FBodyAccelerationJerkMeanX", "The mean of the jerk in acceleration of the subject's body in the X direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationJerkMeanY", "The mean of the jerk in acceleration of the subject's body in the Y direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationJerkMeanZ", "The mean of the jerk in acceleration of the subject's body in the Z direction in the frequency domain", explanation)

explanation <- gsub("FBodyAccelerationJerkStandardDeviationX", "The standard deviation of the jerk in acceleration of the subject's body in the X direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationJerkStandardDeviationY", "The standard deviation of the jerk in acceleration of the subject's body in the Y direction in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationJerkStandardDeviationZ", "The standard deviation of the jerk in acceleration of the subject's body in the Z direction in the frequency domain", explanation)

explanation <- gsub("FBodyGyroscopeMeanX", "The mean of the gyroscope measurement of the subject's body in the X direction in the frequency domain", explanation)
explanation <- gsub("FBodyGyroscopeMeanY", "The mean of the gyroscope measurement of the subject's body in the Y direction in the frequency domain", explanation)
explanation <- gsub("FBodyGyroscopeMeanZ", "The mean of the gyroscope measurement of the subject's body in the Z direction in the frequency domain", explanation)

explanation <- gsub("FBodyGyroscopeStandardDeviationX", "The standard deviation of the gyroscope measurement of the subject's body in the X direction in the frequency domain", explanation)
explanation <- gsub("FBodyGyroscopeStandardDeviationY", "The standard deviation of the gyroscope measurement of the subject's body in the Y direction in the frequency domain", explanation)
explanation <- gsub("FBodyGyroscopeStandardDeviationZ", "The standard deviation of the gyroscope measurement of the subject's body in the Z direction in the frequency domain", explanation)

explanation <- gsub("FBodyAccelerationMagnitudeMean", "The mean of the magnitude of the acceleration of the subject's body in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationMagnitudeStandardDeviation", "The standard deviation of the magnitude of the acceleration of the subject's body in the frequency domain", explanation)

explanation <- gsub("FBodyAccelerationJerkMagnitudeMean", "The mean of the magnitude of the jerk of the acceleration of the subject's body in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationJerkMagnitudeStandardDeviation", "The standard deviation of the magnitude of the jerk of the acceleration of the subject's body in the frequency domain", explanation)

explanation <- gsub("FBodyGyroscopeMagnitudeMean", "The mean of the magnitude of the gyroscope measurement on the subject's body in the frequency domain", explanation)
explanation <- gsub("FBodyAccelerationMagnitudeStandardDeviation", "The standard deviation of the magnitude of the gyroscope measurement on the subject's body in the frequency domain", explanation)

explanation <- gsub("FBodyGyroscopeJerkMagnitudeMean", "The mean of the magnitude of the jerk of the gyroscope measurement on the subject's body in the frequency domain", explanation)
explanation <- gsub("FBodyGyroscopeJerkMagnitudeStandardDeviation", "The standard deviation of the magnitude of the jerk of the gyroscope measurement on the subject's body in the frequency domain", explanation)


VariablePrefixCodebook <- paste("* ", VariablePrefixDescrip,"\n", explanation,"\n")