abs()

abs()

The abs() function will produce the absolute value for a number.

Example: 

The code below will take the residuals from the empty model for Thumb in the Fingers data frame, and give back their absolute value.

empty_model <- lm(Thumb ~ NULL, data = Fingers)
Fingers$Residual <- resid(empty_model)
abs(Fingers$Residual)

Example output:

output of absolute values

    • Related Articles

    • Sum of Absolute Deviations (SAD)

      Sum of Absolute Deviations (SAD) is the total of the absolute values of each deviation from the mean; a way to quantify error, which gets around the problem of the sum of deviations adding up to 0; also called SAE, Sum of Absolute Error.
    • Appendix of Videos in Course Textbook

      These are the instructional videos that appear throughout the course textbook. ​ Title Link What is Between Group vs Within Group Variation? Transcript https://player.vimeo.com/video/379060892  How to Tell if One Variable "Explains Variation" in ...