CHAPTER 17
Beginner
Statistical Analysis in R
Updated: May 18, 2026
5 min read
# CHAPTER 17
Statistical Analysis in R
1. Chapter Introduction
R was built by statisticians for statistical computing — it has the most comprehensive statistical toolkit of any programming language. This chapter masters descriptive statistics, measures of central tendency, dispersion, and shape analysis.2. Measures of Central Tendency
r
3. Measures of Dispersion
r
4. Distribution Shape
r
5. Common Mistakes
- Using mean for skewed data: The mean salary is $84,769 but the median is $75,000. For right-skewed data (income, prices), the median is a better "typical" value because it's not pulled by extreme values.
-
Sample vs population variance:
var()andsd()usen-1(sample statistics). For population parameters, usevar_pop=mean((x - mean(x))^2).
6. MCQs
Question 1
Median is preferred over mean when?
Question 2
IQR(x) computes?
Question 3
Positive skewness indicates?
Question 4
sd() in R uses?
Question 5
shapiro.test() tests for?
Question 6
Coefficient of Variation (CV) measures?
Question 7
Outlier by IQR rule: values outside?
Question 8
mean(x, trim=0.1) computes?
Question 9
summary(x) for numeric vector shows?
Question 10
Geometric mean is appropriate for?
7. Interview Questions
- Q: When would you use median instead of mean?
- Q: What does the IQR tell you about a dataset?
8. Summary
Central tendency:mean() (sensitive to outliers), median() (robust), mode (custom function). Dispersion: var(), sd(), IQR(), quantile(). Shape: skewness() (asymmetry), kurtosis() (tail weight). Normality: shapiro.test(). Outliers: IQR fence = Q1±1.5×IQR. Use summary() for quick 5-number summary. Right-skewed data → prefer median for "typical" value.