Measures of Absolute Variability
[This article was first published on Analysis with R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Measures of absolute variability deal with the dispersion of the data points. This include the following:Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
- Range – range
- Interquartile Range – IQR
- Quartile Deviation
- Average Deviation
- Standard Deviation – sd
Example 1. The heights (in centimetres) of the 17 BS Stat students in section A23 of Statistical Inference under Dr. Supe were recorded. The data are the following: 151, 160, 162, 155, 154, 154, 153, 168, 169, 153, 158, 166, 152, 157, 150, 169, and 167. Compute the range, interquartile range, quartile deviation, average deviation, and standard deviation.
The range is computed using the function range, while the interquartile range is obtained by IQR. Thus,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heights <- c(151, 160, 162, 155, 154, 154, 153, 168, 169, 153, 158, 166, 152, 157, 150, 169, 167) | |
range(heights) | |
[1] 150 169 | |
IQR(heights) | |
[1] 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Range <- function(data){ | |
max(data) - min(data) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Range(heights) | |
[1] 19 |
- $QD$ – quartile deviation
- $Q_3$ – third quartile
- $Q_1$ – first quartile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QD <- function(data){ | |
IQR(data)/2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QD(heights) | |
[1] 6.5 |
- $AD$ – average deviation
- $X_i$ – $i^{th}$ individual observations
- $\bar{X}$ – sample mean
- $n$ – total number of observations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AD <- function(data){ | |
sum(abs(data-mean(data)))/(length(data)-1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AD(heights) | |
[1] 6.257353 |
Reference:
Asaad, Abubakar S. (2011). Simplified Biostatistics. Manila: Rex Book Store, Inc.
To leave a comment for the author, please follow the link and comment on their blog: Analysis with R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.