Monday, 10 June 2013

R: Measures of Absolute Variability

Measures of absolute variability deal with the dispersion of the data points. This include the following:
  • Range - range
  • Interquartile Range - IQR
  • Quartile Deviation
  • Average Deviation
  • Standard Deviation - sd
These measures of variability restrict to uniform units of measurement when comparing two distributions.

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,

The range returned the minimum and maximum values of the data which are 150 and 169, respectively. And for the interquartile range, the output returned the difference between the third and first quartiles. Going back to the range, one might want immediately the difference between the maximum and the minimum values. Well, simply insert this to a function for generality, i.e.

Using this new function, the range would be

For quartile deviation, the formula is given by$$QD=\frac{Q_3-Q_1}{2}$$where:
  • $QD$ - quartile deviation
  • $Q_3$ - third quartile
  • $Q_1$ - first quartile
This equation is just the interquartile range over 2. And thus, the function would be

The quartile deviation of the heights then, follows

Lastly, the mean deviation$$AD=\displaystyle\frac{\displaystyle\sum_{i=1}^{n}\left|X_i-\bar{X}\right|}{n-1}$$where:
  • $AD$ - average deviation
  • $X_i$ - $i^{th}$ individual observations
  • $\bar{X}$ - sample mean
  • $n$ - total number of observations
has an equivalent R code,

And therefore, the average deviation of the heights is,



Reference:

Asaad, Abubakar S. (2011). Simplified Biostatistics. Manila: Rex Book Store, Inc.

No comments:

Post a Comment

Fork me on GitHub