Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This appendix collects answers to the odd-numbered practice problems from every chapter, so you can check your work as you study. Answers are grouped by chapter and listed in numeric order; this page is the single place to find them.

1How to use these answers

  1. Try the problem fully first. Look here only after a genuine attempt — the learning is in the struggle, not the answer.

  2. Check the reasoning, not just the number. If your final value matches but you are unsure why, re-read the worked example in the chapter that the problem follows.

  3. A mismatch is information. When your answer differs, redo the problem slowly; the most common slips are using nn instead of n1n-1, mixing up a one- vs. two-sided test, or rounding too early. Keep full precision until the final step.

  4. Numbers here are reproducible. Every numeric answer was computed with R (the same mosaic and BSDA functions you use) or independently re-derived during verification — none were estimated by hand. Where rounding matters, the chapter states its convention (typically 2–4 significant figures).

2Numbering convention

Practice problems are auto-numbered within each chapter in the order they appear. “Odd-numbered” means problems 1, 3, 5, 7, … of that chapter’s practice set. A reference like “Ch. 7, #9” points to the ninth practice problem in Chapter 7. Answers below are grouped by chapter and listed in numeric order.


3Chapter 1 — Data & Study Design

1. The population is the entire collection you want to learn about; the sample is the subset you actually measure. Example: population = every census tract in Kern County (or every Bakersfield summer day); sample = the handful of tracts (or days) you happen to draw and record.

3. (a) year — categorical, ordinal (ordered standings). (b) total_pop — numerical, discrete (a count of people). (c) pm25 — numerical, continuous (a measurement). (d) commodity — categorical, nominal.

5. It is an observational study (no tract was assigned its pollution level). The strongest honest claim is an association: in Kern, tracts with higher PM2.5 tend to have higher asthma rates. It cannot establish causation.

7. The two questions are: (1) Were units randomly assigned to groups? (\rightarrow causal claims possible.) (2) Were units randomly sampled from a population? (\rightarrow generalization possible.) For a randomized study-methods experiment in one professor’s class: assignment = yes (causal claim possible within the study), sampling = no (a convenience group), so results generalize only cautiously beyond that class.

9. sum(is.na(read.csv("data/processed/kern_calenviroscreen.csv")$poverty)) returns 4: four Kern tracts are missing the poverty value (OEHHA suppression for small tracts), as computed in the chapter from kern_calenviroscreen.

11. A biased method tilts every observation in the same direction, so adding more biased observations makes the estimate more precise around the wrong value. Bias is a flaw in the design, not in the sample size; only fixing how the data are collected removes it.

13. Example answers: (a) continuous numerical — pm25 (µg/m³); (b) discrete numerical — total_pop (count of people); (c) ordinal categorical — year (Freshman… Senior); (d) nominal categorical — major or commodity.

15. Because the missingness is not at random: OEHHA suppresses scores for very small tracts, so dropping those 4 rows systematically removes small (often rural) places. Any conclusion then silently excludes them — a missing-not-at- random bias, not a harmless deletion.

17. A randomized experiment (volunteers randomly assigned to walking vs. control). Scope: random assignment is present \rightarrow it can support a causal claim about the walking program; random sampling is absent (volunteers) \rightarrow the result generalizes only cautiously beyond people like these volunteers.

19. Association means the two variables move together (knowing one tells you something about the other); causation means changing one produces a change in the other. Observational Kern data can establish only the association between PM2.5 and asthma, because confounders are not controlled.

21. Sampling bias (8 a.m.-class students are not representative — they may sleep less, or differ in schedule/work). Likely direction: the estimate of average sleep is biased downward (too low) if early-class students sleep less than the student body overall.

23. survey <- read.csv("data/processed/firstday_survey_sim.csv"); mean(survey$work_hours_week > 0 & !is.na(survey$work_hours_week)) returns 0.56, i.e. 56.0% of all 150 students report paid work — 84 of 150, treating the 4 missing work values as not known to be working (computed in the chapter from the simulated firstday_survey_sim).

25. It is observational (students chose to use tutoring; no random assignment). A confounder: motivation (or prior preparation) — more motivated students both seek tutoring and earn higher grades — so tutoring need not be the cause of the grade difference.

27. In a statistically “average” county you would expect about 25% of tracts above the statewide 75th percentile. Kern has about 49.7% (73 of 147 scored tracts), roughly double — suggesting Kern tracts are concentrated toward the high-burden end of California’s distribution.

29. (a) cluster (whole schools chosen, all students measured); (b) convenience (first 50 seen); (c) simple random (random draw from the full list); (d) stratified (a fixed number from each region/stratum).

4Chapter 2 — Summarizing Numerical Data

1. Mean =(3+7+7+2+11)/5=30/5=6= (3+7+7+2+11)/5 = 30/5 = 6. Median: sorted 2,3,7,7,112,3,7,7,11, middle value =7= 7. So mean = 6, median = 7.

3. Range =112=9= 11-2 = 9. Deviations from mean 6: 3,1,1,4,5-3,1,1,-4,5; squares 9,1,1,16,259,1,1,16,25 sum to 52. Variance s2=52/4=13s^2 = 52/4 = 13; SD s=133.61s=\sqrt{13}\approx \mathbf{3.61}.

5. Mean =xi/n=240/16=15= \sum x_i / n = 240/16 = \mathbf{15}.

7. Right-skewed. The mean (50) exceeds the median (38); a longer right tail of large values pulls the mean above the middle value.

9. Mean: rises a lot. Median: barely changes. SD: rises a lot. IQR: barely changes. (The mean and SD are sensitive to the extreme value; the median and IQR are resistant.)

11. Yes — the middle half is right-skewed. The median (15) sits much closer to Q1Q_1 (12) than to Q3Q_3 (28), so the upper quarter of the box is stretched out, indicating a longer right side.

13. Side-by-side boxplots. They place each neighborhood’s center, spread, and outliers on a common scale so all four distributions can be compared at a glance in one figure.

15. IQR =4020=20= 40-20 = 20. Upper fence =Q3+1.5IQR=40+30=70= Q_3 + 1.5\,\text{IQR} = 40 + 30 = \mathbf{70}; lower fence =2030=10= 20 - 30 = -10. Since 75>7075 > 70, the value 75 is flagged as a high-side outlier.

17. Mean 9.30\approx 9.30 µg/m³, median 7.56\approx 7.56 µg/m³ (dataset-derived from kern_airquality). Because the mean exceeds the median, the distribution is right-skewed (longer tail toward dirty days).

19. Q14.097Q_1 \approx 4.097, Q311.80Q_3 \approx 11.80, IQR 7.703\approx 7.703; upper fence =Q3+1.5IQR23.35= Q_3 + 1.5\,\text{IQR} \approx \mathbf{23.35} µg/m³. 80 monitor-days are flagged as high-side outliers (dataset-derived from kern_airquality).

21. (Open response — sample answer.) The distribution is strongly right-skewed, centered near a median of about 7.6 µg/m³ (mean about 9.3), with most days clustered below 15 and a long thin tail of dirtier days reaching past 60; spread is wide (SD ≈ 7.6 µg/m³).

23. Removing the single worst day (63.7 µg/m³) would change the median almost not at all — the median depends only on the middle position, and dropping one of 1,554 values barely shifts it. The mean would drop slightly because the mean feels every value, but with n=1,554n=1{,}554 one value carries little weight, so the change is small (about 63.7/15540.0463.7/1554 \approx 0.04 µg/m³ less, before re-centering).

25. It hides the skew / the gap between mean and typical day (most days are below 9.3, and a few smoky days inflate the average). Fix: add a sentence such as “but the typical (median) day was about 7.6 µg/m³, with a handful of high-pollution days pulling the average up.”

27. CV=s/xˉ7.63/9.300.821\text{CV} = s/\bar{x} \approx 7.63/9.30 \approx 0.821, i.e. about 82% (dataset-derived from kern_airquality). Relative spread expresses variability as a fraction of the mean, so it is unitless and lets you compare variability across variables measured on different scales or in different units — something the SD alone (which keeps the original units) cannot do.

29. Put the median (7.56) and IQR (7.70) in the headline: for skewed air-quality data they describe the typical day honestly and resist the few extreme days. Put the mean (9.30) and SD (7.63) in a technical appendix, where the total burden and full variability are documented for analysts. (A complete answer may justify the reverse as long as it correctly notes the skew.)

5Chapter 3 — Summarizing Categorical Data & Tables

All numbers computed from kern_crops_sim (simulated; see data/codebooks/kern_crops_sim.md) or from the given counts.

1. 8 commodities. Each has proportion 9/72=0.12509/72 = 0.1250 (12.50%). They are all equal because the dataset is a balanced panel: every commodity appears exactly once per year for all 9 years.

3. NUTS has the largest 2023 acreage share at 60.63% (almonds 37.49% + pistachios 23.14%).

5. Sorted tallest to shortest, ALMONDS (212,747 acres) and PISTACHIOS (131,290 acres) top the chart.

7. Grand total = 72. It equals 72 because every one of the 72 rows (8 commodities × 9 years) lands in exactly one (category, value-tier) cell, so the cell counts sum to the number of rows.

9. P(FRUIT and Lower value)=12/72=0.1667P(\text{FRUIT and Lower value}) = 12/72 = \mathbf{0.1667}.

11. Conditional P(High valuecategory)P(\text{High value}\mid\text{category}), most to least likely: NUTS 1.0000 > CITRUS 0.5556 > FRUIT 0.3333 > VEGETABLE 0.2222 > FIELD CROP 0.0000.

13. The NUTS bar is entirely one color (all High value): its conditional distribution is 100% high-value, 0% lower-value. (FIELD CROP is also a single color, entirely Lower value.)

15. P(High valueNuts)=1.0000P(\text{High value}\mid\text{Nuts}) = \mathbf{1.0000}; P(High valueNot nuts)=0.3333P(\text{High value}\mid\text{Not nuts}) = \mathbf{0.3333}; difference = 0.6667.

17. Proportions: Freshman 0.35, Sophomore 0.27, Junior 0.22, Senior 0.16 (percents 35%, 27%, 22%, 16%). Upper-division (Junior + Senior) share = 76/200=0.3876/200 = \mathbf{0.38} (38%).

19. P(ImprovedDrug)=48/75=0.64P(\text{Improved}\mid\text{Drug}) = 48/75 = \mathbf{0.64}; P(ImprovedPlacebo)=30/75=0.40P(\text{Improved}\mid\text{Placebo}) = 30/75 = \mathbf{0.40}. The conditional proportions differ (0.64 vs. 0.40), so treatment and outcome are associated.

21. ALMONDS and PISTACHIOS are each high-value in all 9 of their crop-years.

23. In a frequency table sorted by descending count, the cumulative percent at the second row is the combined share of the two most common categories — the percent of observations accounted for by the top two categories together.

25. (Communication — sample answer.) “Counting harvested acres, nut crops made up about 61% of the cropland in this dataset for 2023, with almonds alone at roughly 37% and pistachios at 23%. Fruit and citrus each accounted for about 14%, and field crops and vegetables together for under 12%. These are shares of acreage, and they describe what was grown — not why.” (Names the unit, uses proportions, no causal language.)

6Chapter 4 — Probability Foundations

1. P(heads)=1/2=0.5P(\text{heads}) = 1/2 = 0.5; complement P(not heads)=10.5=0.5P(\text{not heads}) = 1 - 0.5 = 0.5.

3. P(roll2)=2/60.333P(\text{roll} \le 2) = 2/6 \approx 0.333; complement =12/6=4/60.667= 1 - 2/6 = 4/6 \approx 0.667.

5. Disjoint, so P(AB)=0.3+0.25=0.55P(A \cup B) = 0.3 + 0.25 = 0.55.

7. Not disjoint: P(CD)=0.20P(C \cap D) = 0.2 \neq 0, so CC and DD can both occur.

9. P(badwinter)=9/850.106P(\text{bad} \mid \text{winter}) = 9/85 \approx 0.106.

11. Not independent: P(badwinter)=9/850.106P(\text{bad}\mid\text{winter}) = 9/85 \approx 0.106 while P(bad)=9/3510.026P(\text{bad}) = 9/351 \approx 0.026. Since the conditional differs from the marginal, the events are dependent.

13. Independent, so P(at least one)=1P(fail both)=1(0.2)(0.3)=0.94P(\text{at least one}) = 1 - P(\text{fail both}) = 1 - (0.2)(0.3) = 0.94.

15. P(positivedisease)P(\text{positive}\mid\text{disease}) asks how often sick people test positive; P(diseasepositive)P(\text{disease}\mid\text{positive}) asks how often positive testers are actually sick. They condition on different things and depend on how common the disease is, so they are generally not equal.

17. P(commutesworks)=0.35/0.60.583P(\text{commutes}\mid\text{works}) = 0.35/0.6 \approx 0.583. Since this differs from P(commutes)=0.5P(\text{commutes}) = 0.5, working and commuting do not appear independent.

19. (Simulation.) Example: set.seed(2200); mean(replicate(20000, any(sample(day$daily_mean, 5, replace = TRUE) > 35))). Report the resulting fraction (it should be a small positive number; the seed value is 2200).

21. Outcomes: A={2,4,6}A=\{2,4,6\}, B={4,5,6}B=\{4,5,6\}. AB={4,6}A \cap B = \{4,6\} so P(AB)=2/60.333P(A\cap B)=2/6\approx 0.333; AB={2,4,5,6}A \cup B = \{2,4,5,6\} so P(AB)=4/60.667P(A\cup B)=4/6\approx 0.667.

23. Independent goods: P(all 3 good)=0.9830.941P(\text{all 3 good}) = 0.98^3 \approx 0.941.

25. Complement rule: P(no bad days)=10.41=0.59P(\text{no bad days}) = 1 - 0.41 = 0.59.

27. Because a sample only observes finitely many repetitions, nA/nn_A/n varies from sample to sample and lands near — but not exactly on — the true long-run probability; it is an estimate that improves as nn grows.

29. Independent: P(A)P(B)=(0.6)(0.5)=0.30=P(AB)P(A)P(B) = (0.6)(0.5) = 0.30 = P(A \cap B), so the product rule holds exactly.

7Chapter 5 — Random Variables & the Normal Model

1. E(X) = 0(0.5) + 1(0.3) + 2(0.2) = 0.7.

3. A discrete random variable takes separated, listable values (e.g. the number of heads in 3 coin flips: 0, 1, 2, or 3). A continuous random variable can take any value in an interval (e.g. a person’s height, which could be 175.79 cm or anything between).

5. z = (66 − 50)/8 = 2.0 (66 is 2 SDs above the mean).

7. Under a Normal model, about 68% of values lie within 1 standard deviation of the mean, about 95% within 2, and about 99.7% within 3.

9. P(X ≤ 168) = pnorm(168, 175.79, 7.48)0.1488 (about 15% of adult men are 168 cm or shorter).

11. 25th percentile of female height = qnorm(0.25, 162.04, 7.30)157.12 cm.

13. 95th percentile = qnorm(0.95, 500, 100)664.49 (round to about 664).

15. A z-score is a value minus the mean, divided by the standard deviation, so the units cancel — it is a pure count of standard deviations. z = −2 means the value lies 2 standard deviations below the mean.

17. P(X = 4) = dbinom(4, 8, 0.5)0.2734.

19. P(exactly 2 of 6) = dbinom(2, 6, 0.27)0.3105.

21. Binary trials, Independent trials, fixed Number of trials, Same success probability on each trial.

23.

air <- read.csv("data/processed/kern_airquality.csv")
ozone <- subset(air, pollutant == "Ozone")
gf_histogram(~ daily_max, data = ozone, bins = 30, fill = "#0072B2", color = "white")

25. No. A mean (40) far above the median (12) signals a strong right skew, which is incompatible with the symmetric Normal model. (A symmetric distribution has mean ≈ median.)

27. The expected value is a long-run average over many repetitions; it need not be an outcome that can occur on any single trial. Averaging 0, 1, 2, 3 days with their probabilities gives 0.9, even though you can never observe 0.9 days on one weekend.

29. IQR = qnorm(0.75, 175.79, 7.48) − qnorm(0.25, 175.79, 7.48) ≈ 180.84 − 170.74 ≈ 10.09 cm.

8Chapter 6 — Sampling Distributions & the CLT

1. A sample distribution is the spread of the raw values in one collected sample (e.g. the PM2.5 readings of 30 specific days). A sampling distribution is the spread of a statistic (e.g. the mean of 10 days) across many samples. The first has measurements on its axis; the second has a computed statistic.

3. False. The CLT is about the sample mean, not the data. The raw data keep their shape (PM2.5 stays right-skewed); only x̄ becomes approximately normal as n grows.

5. The SE changes by a factor of 1/2. Quadrupling n (25\rightarrow100) multiplies √n by 2, so σ/√n is halved.

7. np = (0.05)(120) = 6 < 10, so the success–failure condition fails. The normal approximation for p̂ is not appropriate; successes are too rare for this n.

9. SE = 2.41, so by the 68–95–99.7 rule about 95% of 10-day means fall within ±2(2.41) of 9.30, i.e. roughly 4.5 to 14.1 µg/m³.

11. SE(x̄) = 20.19/√36 = 20.19/6 = 3.36 cm.

13. set.seed(2200); do(4000) * mean(~daily_mean, data = resample(pm, 25)) (with pm <- subset(read.csv("data/processed/kern_airquality.csv"), pollutant == "PM2.5")).

15. SE = σ/√n \Rightarrow n = (σ/SE)² = (7.63/1.08)² ≈ 50 (the sampling distribution came from n = 50).

17. As n grows from 2 to 50, the histogram of x̄ gets narrower (SE shrinks like 1/√n), more symmetric, and more bell-shaped, while staying centered near the population mean.

19. A parameter describes the whole population and is usually fixed/unknown (μ, the population mean). A statistic is computed from a sample and varies sample to sample (x̄, the sample mean); we use the statistic to estimate the parameter.

21. Setting a seed makes the random draws reproducible: the book, app, lab, and grader all get identical simulated samples, so results can be checked exactly.

23. SE = 7.63/√64 = 7.63/8 = 0.954 µg/m³. At n = 4, SE = 7.63/2 = 3.81; so the n = 64 SE is 4 times smaller (√(64/4) = 4).

25. Averaging cancels highs against lows: extreme single days (near 0 or past 60) rarely all land in the same 10-day sample, so 10-day means cluster much more tightly (~4 to 16) than raw days. Spread of the mean = σ/√n, smaller than σ.

27. Solve SE⋆ = σ/√n for n: n = (σ / SE⋆)².

29. The CLT bundles three claims about the sampling distribution of x̄: center = μ (unbiased), spread = σ/√n (standard error), and shape ≈ normal for large n regardless of the population’s shape.

9Chapter 7 — Confidence Intervals

1. A single sample mean is almost certainly off the true mean by some unknown amount; a confidence interval admits that by reporting a range of plausible values rather than pretending the point estimate is exact.

3. False. Higher confidence requires a wider net, so a 99% interval is wider than a 90% interval built from the same data — the relationship is the reverse of what the statement claims.

5. Point estimate =52%= 52\%; margin of error =4= 4 percentage points; implied 95% confidence interval =52%±4%=(48%, 56%)= 52\% \pm 4\% = (48\%,\ 56\%).

7. SE=8/16=2.00SE = 8/\sqrt{16} = 2.00; ME=2.131×2.00=4.26ME = 2.131 \times 2.00 = 4.26; interval =50±4.26=(45.74, 54.26)= 50 \pm 4.26 = (45.74,\ 54.26).

9. 90% interval: 9.23±1.833×(1.664/10)=9.23±0.96=(8.27, 10.19)9.23 \pm 1.833\times(1.664/\sqrt{10}) = 9.23 \pm 0.96 = (8.27,\ 10.19). 99% interval: 9.23±3.250×0.526=9.23±1.71=(7.52, 10.94)9.23 \pm 3.250\times 0.526 = 9.23 \pm 1.71 = (7.52,\ 10.94). The 99% interval is widest because a higher confidence level needs a larger critical value, hence a larger margin of error.

11. xˉ\bar{x} is the midpoint, (7.70+9.52)/2=8.61(7.70+9.52)/2 = 8.61 thousand jobs; MEME is the half-width, (9.527.70)/2=0.91(9.52-7.70)/2 = 0.91 thousand jobs. So the interval is 8.61±0.918.61 \pm 0.91.

13. Success–failure: np^=200(0.40)=8010n\hat p = 200(0.40) = 80 \ge 10 and n(1p^)=12010n(1-\hat p) = 120 \ge 10, so the condition holds. SE=0.40×0.60/200=0.0346SE = \sqrt{0.40\times 0.60/200} = 0.0346; ME=1.96×0.0346=0.068ME = 1.96\times 0.0346 = 0.068; interval =0.40±0.068=(0.33, 0.47)= 0.40 \pm 0.068 = (0.33,\ 0.47).

15. Yes, (0.416,0.577)(0.416, 0.577) includes 0.50. Because a plausible-values range for pp contains one-half, the data are consistent with “about half of scored Kern tracts are high-burden”; we cannot rule out exactly 50%.

17. n(zσ/m)2=(1.96×8/2)2=(7.84)2=61.47n \ge (z^{\star}\sigma/m)^2 = (1.96\times 8/2)^2 = (7.84)^2 = 61.47, round up to n=62n = 62.

19. n(z)2(0.25)/m2=(1.96)2(0.25)/(0.04)2=0.9604/0.0016=600.25n \ge (z^{\star})^2(0.25)/m^2 = (1.96)^2(0.25)/(0.04)^2 = 0.9604/0.0016 = 600.25, round up to n=601n = 601.

21. t.test(~ces_total_nonfarm_thsd, data = read.csv("data/processed/kern_energy_employment.csv"), conf.level = 0.90)

23. About 0.80 of the intervals would capture the truth (an 80% procedure covers ~80% of the time), and each interval would be narrower, because a lower confidence level uses a smaller critical value.

25. tsum.test(mean.x = 8.61, s.x = 1.271, n.x = 10, conf.level = 0.95); expected 95% interval (7.70, 9.52)(7.70,\ 9.52) thousand jobs, matching the raw-data result because the summary statistics are the same ones the raw data produce.

10Chapter 8 — Hypothesis Testing Logic

1. In words: H0H_0 says coaching does not change mean daily active minutes; HAH_A says it does change them. In symbols: H0: μtrtμctrl=0H_0:\ \mu_{\text{trt}} - \mu_{\text{ctrl}} = 0 versus HA: μtrtμctrl0H_A:\ \mu_{\text{trt}} - \mu_{\text{ctrl}} \neq 0.

3. Hypotheses concern the unknown population value we want to learn about; the sample mean xˉ\bar{x} is already known once we have data, so there is nothing to test about it. We test claims about μ\mu using xˉ\bar{x} as evidence.

5. A Type I error is concluding coaching changes active minutes when it truly does not (a false alarm). A Type II error is concluding coaching has no effect on active minutes when it truly does (a missed real effect).

7. False. The p-value is computed assuming the null is true, so it cannot also be the probability that the null is true. A p-value of 0.02 means: if the null were true, a result this extreme would occur about 2% of the time.

9. About 8.92/1.864.88.92 / 1.86 \approx 4.8 standard deviations from 0 — far out in the tail, which is why no shuffle reached it and the p-value is below 0.0001.

11. Yes, consistent. A two-sided p-value just under 0.05 must pair with a 95% CI that just barely excludes 0; here the lower bound 0.003 is just above 0, matching p ≈ 0.043. Both say “reject, but only barely.”

13.

fit <- read.csv("data/processed/fitness_tracker_sim.csv")
hr  <- fit$resting_hr; grp <- fit$group
obs <- mean(hr[grp == "treatment"]) - mean(hr[grp == "control"])
set.seed(2200)
nulls <- replicate(5000, {
  s <- sample(grp)
  mean(hr[s == "treatment"]) - mean(hr[s == "control"])
})
mean(abs(nulls) >= abs(obs))   # two-sided p-value

15. Cohen’s d0.72d \approx 0.72 means the two group means sit about 0.72 standard deviations apart — close to a “large” effect by common conventions. Roughly, a typical treatment student is more active than about three-quarters of control students.

17. The p-value changes only trivially (it stays below 0.0001). Random seeds change which shuffles you draw, but with 10,000 of them the null distribution is essentially the same each time, so a result this extreme is unreachable regardless of seed.

19. H0: μtrtμctrl=0H_0:\ \mu_{\text{trt}} - \mu_{\text{ctrl}} = 0, HA: μtrtμctrl0H_A:\ \mu_{\text{trt}} - \mu_{\text{ctrl}} \neq 0. Observed difference ≈ 942 steps/day; randomization p ≈ 0.0018. Since 0.0018<0.050.0018 < 0.05, reject H0H_0: coaching raised step count.

21. The evidence is essentially identical — 0.049 and 0.051 are indistinguishable in practical terms. This shows that treating 0.05 as a hard cutoff creates an artificial cliff between two nearly identical results; the p-value should be read as a continuous measure of evidence, not a pass/fail gate.

23. From t.test(active_minutes ~ group, data = fit): (a) the p-value (compared to α\alpha — reject or fail to reject) gives the decision; (b) the 95 percent confidence interval for the difference gives the size of the effect (here about (5.46, 12.39) minutes), which the p-value alone cannot.

25. Picking the test direction after seeing which way the data went means you would have chosen the opposite one-sided test had the data gone the other way — so you are really testing both tails while only “paying” for one, which doubles the true Type I error rate above the stated α\alpha. They should have either pre-registered the direction on theoretical grounds or used a two-sided test.

11Chapter 9 — Inference for Proportions

Kern values are computed from data/processed/kern_calenviroscreen.csv.

1. Each unit is coded 1 for a success and 0 for a failure, so the proportion is the average of those values; because it is a mean, the Central Limit Theorem applies and the sampling distribution of p^\hat p is approximately normal.

3. A test assumes H0H_0 is true, so it uses the hypothesized p0p_0 in the standard error (the null SE); a confidence interval makes no null assumption, so it estimates the SE from the data using p^\hat p (the Wald SE).

5. A pp-value is the probability of observing data at least as extreme as ours if the null hypothesis were true — not the probability that H0H_0 is true.

7. p^=38/50=0.76\hat p = 38/50 = 0.76; z=3.68z = 3.68; one-sided pp-value 0.00012\approx 0.00012. Reject H0H_0: strong evidence a majority own a laptop.

9. p^=27/40=0.675\hat p = 27/40 = 0.675; z=2.21z = 2.21; one-sided pp-value 0.013<0.05\approx 0.013 < 0.05. Reject H0H_0: evidence the coin is biased toward heads.

11. p^=120/400=0.30\hat p = 120/400 = 0.30; 95% CI =0.30±1.960.300.70/400=(0.255, 0.345)= 0.30 \pm 1.96\sqrt{0.30\cdot0.70/400} = (0.255,\ 0.345). We are 95% confident 25.5%–34.5% of commuters use transit.

13. (a) Quadrupling nn halves the margin of error (width scales like 1/n1/\sqrt{n}). (b) Raising confidence to 99% widens the interval (zz^\star rises from 1.96 to 2.576).

15. n(z)2p(1p)/ME2=(1.96)2(0.25)/(0.03)2=1067.1n \ge (z^\star)^2 p(1-p)/\text{ME}^2 = (1.96)^2(0.25)/(0.03)^2 = 1067.1, so n=1068n = 1068 (round up).

17. p^1p^2=0.450.25=0.20\hat p_1 - \hat p_2 = 0.45 - 0.25 = 0.20; 95% CI (unpooled SE) (0.075, 0.325)\approx (0.075,\ 0.325). The interval excludes 0, consistent with rejecting H0H_0.

19. p^1p^2=0.700.60=0.10\hat p_1 - \hat p_2 = 0.70 - 0.60 = 0.10; 95% CI (0.024, 0.176)\approx (0.024,\ 0.176). It excludes 0, consistent with the significant test in Problem 18.

21. With pm25 >12> 12: p^=117/151=0.7748\hat p = 117/151 = 0.7748; z=6.75z = 6.75; one-sided pp-value 7×1012\approx 7\times10^{-12}. Reject H0H_0: a clear majority of Kern tracts exceed 12 µg/m³.

23. With pm25 >9> 9: p^=126/151=0.8344\hat p = 126/151 = 0.8344, higher than the 0.7748 at the 12 µg/m³ cutoff. Lowering the threshold counts more tracts as “high,” so the proportion rises — the conclusion depends on the standard you choose.

25. Example: “About half of Kern County’s census tracts (an estimated 50%, 95% confidence interval 42%–58%) rank in the most-burdened quarter of all California neighborhoods — roughly double the statewide share of one in four — and this difference is far too large to be chance.”

27. Study B (n = 500) has the narrower 95% CI: with the same p^\hat p, a larger sample gives a smaller standard error (1/n\propto 1/\sqrt{n}) and thus a tighter interval.

29. A very large sample can make a trivial difference statistically significant. Example: a difference of 50.1% vs. 50.0% support across two million voters could yield a tiny pp-value yet have no practical consequence. Always read the confidence interval to judge the effect size.

12Chapter 10 — Inference for Means

1. One-sample, because there is one group of measurements (the nine yearly almond yields) compared to one fixed benchmark, μ₀ = 1 ton per acre. There is no second group of data, so a two-sample test does not apply.

3. SE = s/√n = 8/√16 = 8/4 = 2.0; t = (x̄ − μ₀)/SE = (48 − 50)/2 = −1.0; df = n − 1 = 15.

5. t.test(crops$yield_per_acre[crops$commodity == "PISTACHIOS"], mu = 1.2) (any equivalent that passes the pistachio yields and mu = 1.2 is correct).

7. We are 95% confident the program increases mean daily steps by somewhere between about 346 and 1,538 steps per day — a positive range that does not include zero, so the program plausibly adds a few hundred to about fifteen hundred steps a day on average.

9. SE = 0.20/√9 = 0.0667; t = (7.31 − 7)/0.0667 ≈ 4.65 on df = 8. Since |4.65| > t⋆ = 2.31, reject H₀: the mean table-grape yield differs from 7 tons/acre.

11. t.test(resting_hr ~ group, data = fit) (after fit <- read.csv("data/processed/fitness_tracker_sim.csv")).

13. A non-significant comparison shows two boxes at nearly the same height with heavy overlap — the medians sit close together and each box spans much of the other. Compared to Image, where the treatment box is clearly shifted up, a non-significant picture would have the boxes essentially level.

15. The numbers are simulated because the real USDA NASS feed needed an email-registered API key the build could not provision; presenting synthetic numbers as real would be fabrication (a hard rule). With a real NASS key the identical code would run on real Kern data and those measured values would replace the simulated ones — the method does not change.

17. With p = 0.048 < 0.05 we reject H₀: a detectable sleep difference. But 0.048 is barely below 0.05, the effect (≈0.27 hour ≈ 16 minutes) is small, and a slightly different sample could flip the decision — so treat it as weak, borderline evidence, not a large effect.

19. A p-value above 0.05 means we fail to reject H₀ — one ton per acre stays plausible — but it never proves μ equals exactly 1. The data are simply consistent with μ = 1 along with a whole interval of nearby values (here, 0.977 to 1.095).

21. H₀: μ_A − μ_B = 0 vs. H_A: μ_A − μ_B ≠ 0. SE = √(6²/40 + 5²/35) = √(0.900 + 0.714) ≈ 1.27 minutes. (The resulting t ≈ 3/1.27 ≈ 2.36 is significant, but only the SE was required.)

23. Individual crops can move sharply in opposite directions — pistachios and almonds up, cotton down — so the large positive and negative differences partly cancel, leaving a modest average change. With only eight crops, the big crop-to-crop spread (s_d ≈ 22,000 acres) makes the standard error large, so even an ~8,200-acre average change is small relative to its noise (p = 0.329).

25. Smaller. For t = 1.80 with H_A: μ > 100, the one-sided p-value uses only the upper tail, so it is exactly half the two-sided p-value for the same t (one-sided ≈ 0.042 vs. two-sided ≈ 0.084).

13Chapter 11 — Chi-Square Methods

Numbers are dataset-derived where noted (computed from data/processed/ and independently cross-checked).

1. df=k1=61=5df = k - 1 = 6 - 1 = 5.

3. (OE)2/E=(1220)2/20=64/20=3.20(O-E)^2/E = (12-20)^2/20 = 64/20 = 3.20.

5. Expected counts =npi=(80,60,40,20)= n p_i = (80, 60, 40, 20); they sum to 200. ✓

7. χ2=9.5>9.49\chi^2 = 9.5 > 9.49 (the df=4df=4 critical value), so reject H0H_0 at α=0.05\alpha = 0.05 (barely significant).

9. Yes. With equal proportions and n=30n = 30, k=3k = 3, each expected count is 30/3=10530/3 = 10 \ge 5, so the expected-count condition is met.

11. Observed quartile counts (Q1–Q4) =(11,30,33,73)= (11, 30, 33, 73), n=147n = 147; goodness-of-fit vs. equal proportions gives χ2=55.42\chi^2 = 55.42, df=3df = 3, p5.6×1012p \approx 5.6\times10^{-12}reject H0H_0; Kern tracts concentrate in the top burden quartile. (Dataset-derived: kern_calenviroscreen.)

13. The Hispanic-majority / high-burden cell holds about 2.88 standard units more tracts than independence predicts — that combination is markedly over-represented in the table.

15. The table cross-classifies the five crop categories by two year-eras. FIELD CROP and VEGETABLE each contain only one commodity, so their row totals are small; under independence their expected counts (about 4) fall below 5, so the expected-count condition is at risk and must be checked (it in fact fails for those rows). (Dataset-derived: kern_crops_sim; smallest expected =4.0= 4.0.)

17. Demographics-by-burden independence test: χ2=32.38\chi^2 = 32.38, df=1df = 1, p1.3×108p \approx 1.3\times10^{-8}, Cramér’s V 0.47\approx 0.47reject independence; the two are moderately strongly associated. (Dataset-derived: kern_calenviroscreen.)

19. Expected count per face =60/6=10= 60/6 = 10; df=61=5df = 6 - 1 = 5. The observed counts (8,9,10,11,10,12)(8,9,10,11,10,12) sit very close to 10, so (OE)2/E(O-E)^2/E is tiny in every cell and χ2\chi^2 will be small — little evidence against a fair die.

21. Splitting at the medians of pm25 and education gives a 2×22\times2 table; the test of independence yields χ2=0.17\chi^2 = 0.17, df=1df = 1, p0.68p \approx 0.68fail to reject: no evidence of association between high PM2.5 and a high education gap at the tract level. (Dataset-derived: kern_calenviroscreen.)

23. Expected counts (equal null) =100/4=25= 100/4 = 25 each; per-cell terms (152+52+52+152)/25=(225+25+25+225)/25=20(15^2 + 5^2 + 5^2 + 15^2)/25 = (225+25+25+225)/25 = 20, so χ2=20.0\chi^2 = 20.0, df=3df = 3.

25. Percentages discard the sample sizes the chi-square statistic depends on, so the same percentages from n=20n = 20 and n=2000n = 2000 would give the same (wrong) table of counts. They must supply the raw observed counts in each cell.

27. Every term in χ2=(OE)2/E\chi^2 = \sum (O-E)^2/E is a squared quantity divided by a positive expected count, so every term is 0\ge 0; a sum of non-negative terms cannot be negative.

29. H0H_0: Kern’s census tracts are evenly split across the four statewide burden quartiles (each quartile holds one-quarter of the tracts). HAH_A: at least one quartile holds a different share than one-quarter.

14Chapter 12 — ANOVA

1. H0: μ1=μ2=μ3=μ4=μ5H_0:\ \mu_1=\mu_2=\mu_3=\mu_4=\mu_5 (all five monitors have equal mean PM2.5). HA:H_A: at least one monitor’s mean PM2.5 differs from the others.

3. η2=SSB/SST=90/(90+210)=90/300=0.30\eta^2 = \text{SSB}/\text{SST} = 90/(90+210) = 90/300 = 0.30. Group membership explains 30% of the total variation in the response.

5. dfbetween=k1=2df_{\text{between}} = k-1 = 2; dfwithin=Nk=15df_{\text{within}} = N-k = 15; MSB=60/2=30\text{MSB} = 60/2 = 30; MSW=90/15=6\text{MSW} = 90/15 = 6; F=30/6=5.0F = 30/6 = 5.0.

7. m=(52)=10m = \binom{5}{2} = 10 comparisons; family-wise error 1(10.05)10=0.40\approx 1-(1-0.05)^{10} = 0.40.

9. F=4.0653F = 4.0653 on (2,854)(2, 854) df, p=0.0175p = 0.0175 (dataset-derived, kern_airquality, three Bakersfield PM2.5 monitors).

11. With the five monitors having 100\ge 100 days (the three Bakersfield sites plus Mojave–Pat Avenue and Ridgecrest–Ward), F124.68F \approx 124.68, p<0.0001p < 0.0001 (dataset-derived, kern_airquality). Adding the cleaner desert monitors makes the differences far larger.

13. F=30/12=2.5F = 30/12 = 2.5 on (3,36)(3, 36) df, p0.075>0.05p \approx 0.075 > 0.05: not significant; fail to reject H0H_0.

15. A ratio of 3.1 exceeds 2, so the equal-variance (homogeneity) condition is threatened; use a Welch ANOVA (oneway.test(y ~ g, var.equal = FALSE)).

17. Tons/acre and bales/acre are different units of measurement, so the groups are not on a common scale; the resulting FF would reflect the unit mismatch, not a real difference in productivity.

19. m=(62)=15m = \binom{6}{2} = 15 comparisons; Bonferroni per-test threshold α=0.05/150.0033\alpha^* = 0.05/15 \approx 0.0033.

21. Only California Avenue vs. Golden / M Street is significant after Tukey adjustment (adjusted p0.013p \approx 0.013; Golden runs about 1.76 µg/m³ higher) — dataset-derived, kern_airquality.

23. The analyst who runs ANOVA controls the error rate: one omnibus test holds the overall false-positive risk at 5%, whereas cherry-picking the single “significant” pair from 10 unadjusted tests inflates the family-wise error to about 40%.

25. (Open response.) A strong answer states that the three Bakersfield monitors’ average daily PM2.5 do differ statistically (p=0.0175p = 0.0175), that the gap traces mainly to Golden/M Street reading about 1.8 µg/m³ higher than California Avenue, but that the monitor explains under 1% of the day-to-day variation (η2<0.01\eta^2 < 0.01) — so location matters far less than the season. Plain language, no jargon, both the difference and its small size reported honestly.

15Chapter 13 — Correlation & Linear Regression

1. rr is a unit-free number between −1 and +1; its sign gives the direction of the linear relationship (+ upward, − downward) and its magnitude gives the strength (0 = no linear pattern, 1 = points exactly on a line).

3. r0.34r \approx 0.34 (crude vs. unemployment rate, from kern_energy_employment). It is positive but only weak-to-moderate in strength — much weaker than the oilfield-jobs correlation.

5. y^=3.0411+0.0367(130)=3.0411+4.771=7.81\hat{y} = 3.0411 + 0.0367(130) = 3.0411 + 4.771 = 7.81 thousand jobs (about 7,810 oilfield jobs).

7. Because x=0x=0 (zero production) is far outside the observed range (110–201 million barrels). Reporting the intercept as a real job count is extrapolation; here it is only a mathematical anchor for the line.

9. “About 73% of the year-to-year variation in oilfield employment is explained by crude-production levels; the remaining 27% reflects other factors.” (Based on kern_energy_employment.)

11. A residual is the vertical distance between an observed value and the line’s predicted value, yiy^iy_i-\hat{y}_i. When a straight line fits well, residuals scatter randomly around zero with no curve and constant spread.

13. An outlier has a large residual (far from the line in the yy direction); a high-leverage point has an extreme xx value. A point is influential when removing it noticeably changes the slope or intercept — usually a high-leverage point that is also off the trend.

15. H0:β1=0H_0:\beta_1=0 versus Ha:β10H_a:\beta_1\neq 0. H0H_0 claims there is no linear relationship between the variables — the true slope is zero, so the apparent tilt is just sampling noise.

17. Linearity, Independence, Normal residuals, Equal spread. Independence is most questionable here: the rows are consecutive years of one county, so observations may be correlated across time.

19. r0.935r \approx 0.935 (crude vs. oil-sector share of payroll, kern_energy_employment) — stronger than the r0.856r\approx 0.856 with oilfield job counts. Likely because the share also reflects the falling total payroll denominator, so both numerator and denominator move with the oil decline, sharpening the linear pattern.

21. Slope 0.4475\approx -0.4475 thousand jobs per million barrels (kern_energy_employment). The sign is negative — opposite the oilfield-jobs slope — because as oil production declined the Bakersfield economy diversified, adding non-oil jobs, so total payroll rose while oil fell.

23. Misconception: R2R^2 is not a “percent of predictions correct.” R2=0.73R^2=0.73 means the line explains about 73% of the variation in the response; it is about variance explained, not a hit rate.

25. Rescaling xx leaves rr, R2R^2, and the slope’s p-value unchanged (they are scale-invariant), but the slope b1b_1 changes — dividing xx by 1000 multiplies the slope by 1000, since slope carries the units “jobs per xx-unit.”

27. Example: ice-cream sales and number of sunburns (both rise in summer). Ice cream does not cause sunburns; the lurking variable is hot, sunny weather, which drives both. (Other valid answers: shoe size and reading ability in children \rightarrow age.)

29. R2=0.402=0.16R^2 = 0.40^2 = 0.16. The correlation r=0.40r=0.40 says the relationship is positive and moderate; R2=0.16R^2=0.16 says the line explains only 16% of the variation — a reminder that a moderate-looking rr can leave most variation unexplained.