Sampling distributions — practice in R with the campus wifi, replicate, histograms, qchisq, qt and qf (and the curve that was off by one degree of freedom)
The night before the sampling distributions practice I spent half an hour staring at a histogram that didn’t fit. I had simulated 10,000 variances of 15 pings, computed and drawn the chi-square on top with curve(dchisq(x, n), add = TRUE). The curve always sat a little to the right of the histogram, as if the simulation were wrong. It wasn’t: the curve was. The degrees of freedom were n − 1, not n. With dchisq(x, n - 1) it fitted first time, and that is exactly what you will see in program 2.
This is the R practice for sampling distributions: three programs that check by simulation what the theory and the proofs do on paper. The first draws the topic’s three families (chi-square, t and F) and gets their quantiles; the second simulates 10,000 afternoons of 15 pings and checks the distribution of the mean and the variance; the third compares two buildings with the F and the two-sample t. They are medium level and follow the course practice sessions: d/p/q/r functions, replicate, histograms with their density on top, and every number in every output explained.
Table of Contents
Before you start
It helps to be clear on:
- R’s four letters (
d,p,q,r) and thatp…gives the left tail, . - That a simulated probability is
mean(condition)over many repetitions. - That
replicate(m, expression)repeats the whole expression, so each sample’s simulation has to go inside it. - The four results from the theory: , , and with equal σ.
If any of them sounds shaky, review the theory before carrying on.
The three programs can be pasted as they are into the R playground on the site or RStudio. They only use base R and carry set.seed(2026): if you copy them exactly, you get the same numbers as here. The example is the topic’s: the latency of a ping in Computer Science, ms.
Program 1: the three families, drawn and as quantiles
The first step in the course’s practice 10 is to look at the three new distributions. This program draws their densities in one three-panel plot and produces the quantile table you will use in the exam.
The idea
- One panel per family with
par(mfrow = c(1, 3)): the chi-square with 3, 8 and 15 degrees of freedom, the t with 2 and 14 against the normal, and the F with two pairs of degrees. - A table with the “exam” quantiles for several degrees of freedom: the chi-square’s 95 %, the t’s 97.5 % (compared with the normal’s 1.96) and the F’s 95 % with 10 degrees in the denominator.
In plain words: each new family in this topic answers a different question about the pings. The chi-square is for the variance of one sample. The t is for the mean when you don’t know σ and have to use in its place. And the F compares the spread of two buildings.
The number you’ll be asked for from each one is a quantile: the value that leaves a given probability to its left. If the question talks about “the top 5 %”, you look for the one that leaves 95 % on the left (qchisq(0.95, …)). If it talks about “5 % split between the two tails”, you look for the one that leaves 97.5 % (qt(0.975, …)).
Before programming, think about what you expect: the chi-square moves right with the degrees (mean n), the t looks more and more like the normal and the t quantiles drop towards 1.96.
The code
par(mfrow = c(1, 3)) # three plots in a row
# 1. Chi-square: mean k, variance 2k
curve(dchisq(x, 3), 0, 30, lwd = 2, ylab = "f(x)", main = "Chi-square")
curve(dchisq(x, 8), add = TRUE, lwd = 2, col = "red")
curve(dchisq(x, 15), add = TRUE, lwd = 2, col = "blue")
# 2. Student's t against N(0, 1)
curve(dnorm(x), -4, 4, lty = 2, ylab = "f(x)", main = "Student's t")
curve(dt(x, 2), add = TRUE, lwd = 2)
curve(dt(x, 14), add = TRUE, lwd = 2, col = "red")
# 3. Snedecor's F
curve(df(x, 5, 10), 0, 4, lwd = 2, ylab = "f(x)", main = "Snedecor's F")
curve(df(x, 14, 11), add = TRUE, lwd = 2, col = "red")
par(mfrow = c(1, 1)) # back to one plot
# 4. The exam quantile table
dfs <- c(2, 5, 10, 14, 30, 100)
quantiles <- data.frame(dfs,
chi_95 = qchisq(0.95, dfs), # leaves 5 % on the right
t_975 = qt(0.975, dfs), # leaves 2.5 % in each tail
F_95_10 = qf(0.95, dfs, 10)) # dfs on top, 10 below
round(quantiles, 3)
qnorm(0.975) # the normal's, to compare
Output
dfs chi_95 t_975 F_95_10 1 2 5.991 4.303 4.103 2 5 11.070 2.571 3.326 3 10 18.307 2.228 2.978 4 14 23.685 2.145 2.865 5 30 43.773 2.042 2.700 6 100 124.342 1.984 2.588 [1] 1.959964
In the picture, the three panels made by par(mfrow = c(1, 3)). Each has its own scale: the chi-square goes up to 30, the t from −4 to 4 and the F from 0 to 4.
How to read it
- chi_95: the value a chi-square exceeds only 5 % of the time. With 14 degrees, 23.685: the one that appears in the theory for the variance of 15 pings. It grows roughly like : with many degrees of freedom the mean dominates.
- t_975 against 1.959964: with 2 degrees of freedom you have to go out to 4.303 to leave 2.5 % in each tail; with 14, to 2.145; with 100, to 1.984. This is the table that explains the theory’s hook: with few data, “1.96” falls well short.
- F_95_10: with 10 degrees below, the F’s 95 % quantile drops from 4.103 (2 on top) to 2.588 (100 on top). There is one number per pair of degrees: that is why you compute it with
qfand don’t memorise it. - The picture: on the left, the chi-square shifts and flattens as the degrees grow; in the center, t(2) is the lowest with the fattest tails, and t(14) almost covers the dashed normal; on the right, the two Fs are positive and skewed to the right, with the peak before 1.
The 14-degrees row, read aloud
15 pings give degrees: row 4 is the one you’ll use most. This is how it reads, to 2 decimals:
| Call | Value | What it says | Why that number |
|---|---|---|---|
qchisq(0.95, 14) | 23.68 | with σ = 6, only goes above 23.68 one afternoon in 20 | |
qt(0.975, 14) | 2.14 | leaving 0.975 on the left leaves 0.025 above and, by symmetry, another 0.025 below | |
qnorm(0.975) | 1.96 | the same, but if you knew σ | |
qf(0.95, 14, 10) | 2.86 | 14 degrees on top and 10 below: the order is the order of the ratio |
Rows 2 and 3 together: if you knew σ, 1.96 would be enough; since you estimate it with 15 pings, you have to go out to 2.14, 9 % further (). That is the cost of not knowing σ.
Check you’ve got it: which call gives the value program 3 uses for the F, and why isn’t it in the table?
It is qf(0.95, 14, 11), which is 2.74. Program 3 compares 15 Computer Science pings ( degrees on top) with 12 library pings ( below). The table fixes 10 degrees below, so the 14 row gives 2.86, not 2.74. With one more degree below, the denominator estimates the variance better and the quantile drops a little: each F is computed with its exact pair of degrees.
Questions you might ask
What is par(mfrow = c(1, 3)) and then c(1, 1) for? The first splits the plot window into one row of three; the second puts it back. If you don’t restore it, the next plot you make comes out small, in a third of the window.
Why qt(0.975, …) and not qt(0.95, …)? Because the number used with the t is the one that leaves 5 % split between both tails, 2.5 % in each. qt(0.95, …) leaves the 5 % only on the right: it is the one used when the question has a single tail.
Does qchisq(0.95, dfs) with a vector of degrees work? Yes: the q… functions accept vectors and return one quantile per value. No sapply needed here.
Why does the F peak before 1? Because it is a ratio of two variances estimating the same thing: it usually comes out close to 1, but it can be very large (small denominator) and never negative. That asymmetry pushes the peak left and the mean slightly above 1, .
Writing qf(0.95, 10, dfs) when you wanted dfs on top. R doesn’t warn you: it returns other perfectly valid numbers. The order of the degrees is the order of the ratio.
Try it yourself
- Add a column with
qchisq(0.05, dfs)to the table and check that the chi-square is not symmetric: the left 5 % is not the same distance from the mean as the 95 %. - Draw
curve(dt(x, 100), …)on top of the normal and useqt(0.975, 1000)to find how many degrees you need for the quantile to be 1.96 to two decimals.
Program 2: the mean and variance of 15 pings, 10,000 times
This is the heart of the practice: checking by simulation that the mean of 15 pings is an , that is a and that the two are independent.
The idea
- A function
one_afternoon()that measures 15 pings inside and returns their mean and variance. replicate(10000, one_afternoon())gives a matrix with 2 rows and 10,000 columns: the first row holds the means and the second the variances.- We compare the mean and standard deviation of what we simulated with the theory, draw both histograms with their density on top and look at the correlation between means and variances.
In plain words: one afternoon is one sample. You measure 15 pings, keep two numbers (their mean and their variance) and throw the pings away. Repeat that 10,000 times and you’ll have 10,000 means: how they spread out is, literally, the “sampling distribution” in the title.
The variance isn’t compared with the chi-square as it is. First it is turned into , which is the quantity the theory says follows a . The histogram of untransformed would be centred on 36, the true σ², and wouldn’t match any chi-square.
Before programming, think about what you should see: means with standard deviation , values of with mean 14 and variance 28, and a correlation close to 0.
The code
set.seed(2026)
mu <- 40; sigma <- 6; n <- 15
one_afternoon <- function() { # the sample is made INSIDE
x <- rnorm(n, mu, sigma) # 15 Computer Science pings
c(mean = mean(x), s2 = var(x)) # var() divides by n - 1
}
sim <- replicate(10000, one_afternoon()) # 2 x 10000 matrix
means <- sim["mean", ]
u <- (n - 1) * sim["s2", ] / sigma^2 # (n - 1) S^2 / sigma^2
round(c(mean_means = mean(means), sd_means = sd(means),
theoretical = sigma / sqrt(n)), 3)
round(c(mean_u = mean(u), var_u = var(u)), 2) # chi^2(14): 14 and 28
round(cor(means, sim["s2", ]), 3) # independent: close to 0
# The two histograms, with the theoretical distribution on top
par(mfrow = c(1, 2))
hist(means, freq = FALSE, breaks = 40, main = "Mean of 15 pings", xlab = "ms")
curve(dnorm(x, mu, sigma / sqrt(n)), add = TRUE, lwd = 2, col = "red")
hist(u, freq = FALSE, breaks = 40, main = "(n - 1) S^2 / sigma^2", xlab = "")
curve(dchisq(x, n - 1), add = TRUE, lwd = 2, col = "red") # n - 1, not n
par(mfrow = c(1, 1))
Output
mean_means sd_means theoretical
40.013 1.574 1.549
mean_u var_u
14.01 28.54
[1] 0.001
In the picture, the two histograms from par(mfrow = c(1, 2)): on the left the means, symmetric and narrow; on the right , positive and with the tail on the right. Both red curves fit.
How to read it
- mean_means 40.013 and sd_means 1.574 against 1.549: the mean of 15 pings is centred on 40 and its standard deviation is one ping’s divided by . The two-hundredth difference is simulation noise.
- mean_u 14.01 and var_u 28.54: they are the mean and variance of a (14 and 28). If you had drawn the , its mean would be 15: the histogram would sit left of the curve, which is what happened to me in the hook.
- cor 0.001: the correlation between the 10,000 means and the 10,000 variances is practically 0. That is what the theory says: with normal data, and are independent (a correlation of 0 alone does not prove it, but a linear dependence would show up here).
- The picture: the normal over the means and the 14-degree chi-square over fit bar by bar. If the curve in the right panel were shifted, suspect number one is the degrees of freedom.
The first afternoon, unfolded
replicate doesn’t show you any afternoon. To see one column of sim, take the first one outside, with the same seed:
set.seed(2026)
mu <- 40; sigma <- 6; n <- 15
x <- rnorm(n, mu, sigma) # the first afternoon, taken outside just to look at it
round(x, 2)
round(c(sum = sum(x), mean = mean(x), ss = sum((x - mean(x))^2),
s2 = var(x), u = (n - 1) * var(x) / sigma^2), 2)
Output:
[1] 43.12 33.52 40.84 39.49 36.00 24.90 35.59 33.88 40.68 37.16 37.55 35.62 [13] 38.67 38.65 24.72 sum mean ss s2 u 540.39 36.03 387.45 27.68 10.76
It is the first column of sim. Step by step:
| Step | Calculation | Result | Why |
|---|---|---|---|
| Mean | 36.03 | a slightly fast afternoon: 4 ms below 40, about 2.6 standard deviations of the mean () | |
| Sum of squares | 387.45 | how far each ping is from 36.03, squared and added up | |
| 27.68 | var() divides by , not by 15 | ||
| 10.76 | moved to the scale: below its mean of 14, because this afternoon came out with little spread |
This afternoon adds a 36.03 to the histogram of the means and a 10.76 to the one of ; the other 9,999 do the same.
Check you’ve got it: where does the 13.07 in the question about dividing by n come from?
If you divide the sum of squares by 15 instead of 14, every variance comes out multiplied by . With the first afternoon: instead of 27.68. The same happens to the mean of : instead of 14 it comes out as . The curve sits to the right of the histogram: the symptom from the hook, from the other side.
Questions you might ask
Why does the function return a named vector? Because then replicate returns a matrix whose rows are called mean and s2, and you pick them with sim["mean", ]. Without names, you would have to remember that the mean is row 1.
Why var(x) and not sum((x - mean(x))^2) / n? Because the theory’s result is for , with . var() already divides by . If you divided by n, would have mean 13.07 instead of 14 and the curve would not fit.
Is the correlation close to 0 for any population? No. With a skewed population (exponential, for example), samples with a high mean tend to have a high variance, and the correlation comes out clearly positive. The independence of and is exclusive to the normal.
Why breaks = 40? To have thin bars and see the shape well. With the default bars (about 20) it works too, but the comparison with the curve is coarser.
Making the sample outside the function (x <- rnorm(15, 40, 6) and then replicate(10000, mean(x))). R repeats the mean of the same sample 10,000 times: all the means come out equal and the histogram is a single bar.
Try it yourself
- Replace
rnorm(n, mu, sigma)withrexp(n, 1 / 40)(exponential pings with mean 40) and look at the correlation between means and variances: it no longer comes out close to 0. And the histogram of againstdchisq(x, 14)? - With the same 10,000 values, compute
mean(sim["s2", ] > 60.9): according to the theory, it should come out close to 0.05.
Program 3: two buildings with the F and the two-sample t
Now, two samples at once: 15 pings in Computer Science and 12 in the library. First we assume the two buildings are the same (mean 40 and σ = 6 in both) and check that the F and the two-sample t behave as the theory says. Then we make the library slower (mean 46) and see what happens to the t.
The idea
- A function
two_buildings(mu2)that measures both samples inside and returns the ratio of variances and the pooled-variance t. - With
mu2 = 40(equal buildings): the ratio must exceedqf(0.95, 14, 11)5 % of the time and the t fall outsideqt(0.975, 25)another 5 %. - With
mu2 = 46: the F does not change (the variances are still equal), but the t moves towards negative values. What proportion of the time does it fall below ?
In plain words: now each repetition is two afternoons at once, one in each building, and two numbers come out of them. The ratio of variances only looks at how spread out the pings are in each place; the t looks at how far apart the means are, measured in units of their error. With equal buildings you check that both fall outside their quantile 5 % of the time; with the library 6 ms slower, the question becomes “how often do I notice?”.
Before programming, think about which degrees of freedom apply: the F with 14 and 11 (each sample minus 1, Computer Science on top) and the t with .
The code
set.seed(2026)
m <- 15; n <- 12; sigma <- 6
two_buildings <- function(mu2) {
a <- rnorm(m, 40, sigma) # Computer Science
b <- rnorm(n, mu2, sigma) # library
sp <- sqrt(((m - 1) * var(a) + (n - 1) * var(b)) / (m + n - 2)) # pooled variance
c(F = var(a) / var(b), # S1^2 / S2^2 ~ F(14, 11)
t = (mean(a) - mean(b)) / (sp * sqrt(1 / m + 1 / n))) # ~ t(25) if mu2 = 40
}
equal <- replicate(10000, two_buildings(40))
c(F_tail = mean(equal["F", ] > qf(0.95, m - 1, n - 1)),
t_tails = mean(abs(equal["t", ]) > qt(0.975, m + n - 2)))
round(c(mean_F = mean(equal["F", ]), theoretical = (n - 1) / (n - 3)), 3)
slow <- replicate(10000, two_buildings(46))
c(F_tail = mean(slow["F", ] > qf(0.95, m - 1, n - 1)),
t_below = mean(slow["t", ] < qt(0.025, m + n - 2)))
par(mfrow = c(1, 2))
hist(equal["F", ], freq = FALSE, breaks = 60, xlim = c(0, 5), main = "S1^2 / S2^2", xlab = "")
curve(df(x, m - 1, n - 1), add = TRUE, lwd = 2, col = "red")
hist(equal["t", ], freq = FALSE, breaks = 40, main = "Two-sample t", xlab = "")
curve(dt(x, m + n - 2), add = TRUE, lwd = 2, col = "red")
par(mfrow = c(1, 1))
Output
F_tail t_tails
0.0531 0.0507
mean_F theoretical
1.221 1.222
F_tail t_below
0.0472 0.6990
In the picture, on the left the histogram of the ratio of variances with the and on the right the t’s with the , both with equal buildings.
How to read it
- F_tail 0.0531 and t_tails 0.0507 (equal buildings): the ratio of variances exceeds the 95 % quantile of 5.3 % of the time and the t falls outside 5.1 % of the time. Both close to the 5 % the theory promises.
- mean_F 1.221 against 1.222: the mean of an is , not 1. The F is skewed to the right and its mean sits above 1 even though the two variances are equal.
- F_tail 0.0472 with the slow library: changing the mean does not change the variances: the F stays the same. The F only “sees” variances.
- t_below 0.6990: with the library 6 ms slower, the two-sample t falls below 70 % of the time. In other words: with 15 and 12 pings, a real 6 ms difference is detected seven times out of ten; the other three it goes unnoticed.
- The picture: the F histogram, positive and with a long right tail (which is why
xlim = c(0, 5)cuts off a few very large values), follows the curve; the t’s is symmetric and hugs the .
The first pair of buildings, by hand
One repetition of two_buildings(40), taken outside with the same seed:
set.seed(2026)
m <- 15; n <- 12; sigma <- 6
a <- rnorm(m, 40, sigma) # Computer Science
b <- rnorm(n, 40, sigma) # library, with mu2 = 40
sp2 <- ((m - 1) * var(a) + (n - 1) * var(b)) / (m + n - 2)
round(c(mean_a = mean(a), s2_a = var(a), mean_b = mean(b), s2_b = var(b),
F = var(a) / var(b), sp2 = sp2, se = sqrt(sp2) * sqrt(1 / m + 1 / n),
t = (mean(a) - mean(b)) / (sqrt(sp2) * sqrt(1 / m + 1 / n))), 2)
Output:
mean_a s2_a mean_b s2_b F sp2 se t 36.03 27.68 42.67 38.80 0.71 32.57 2.21 -3.00
Computer Science repeats the first afternoon of program 2 (same seed). Step by step:
| Step | Calculation | Result | Why |
|---|---|---|---|
| 0.71 | Computer Science on top, as in the theory; below 1 because this time the library came out more spread out | ||
| 32.57 | average of the two variances, weighted by their degrees: the 15-ping one weighs more | ||
| Error of the difference | 2.21 | how much usually moves by pure chance | |
| −3.00 | the difference in means measured in errors |
Look at the last number. The two buildings are equal (both with mean 40) and yet this t falls outside . It is one of the false alarms: this pair falls in the 5.1 % of t_tails. With a single pair you can’t tell whether the method is wrong 5 % or 50 % of the time: that is why 10,000 are simulated.
Questions you might ask
Why (n - 1) / (n - 3) for the mean of the F? Because the mean of an is , and here : . It only depends on the degrees below.
Why does the t in the second simulation go negative? Because the numerator is , Computer Science minus library, and the library is slower: the difference comes out negative almost always. Had you subtracted the other way round, it would go positive.
What if the σs are not equal? The pooled-variance t stops being an exact t. With similar sizes the error is small; with very different sizes and very different σs, the 5 % stops being 5 %. That is what Welch’s t is for, in ME2.
Why breaks = 60 for the F? Because the F has very large values now and then and, with few bars, all the mass fits into three or four. With more bars and xlim you see the shape of the zone that matters.
Using qt(0.975, m + n) or qt(0.975, m - 1). For the pooled-variance two-sample t there are degrees: one degree per estimated mean.
Try it yourself
- Repeat the second simulation with 40 and 40 pings (
m <- 40; n <- 40): how often is the 6 ms difference detected now? - Simulate the difference of two chi-squares, as in practice 10:
x <- rchisq(1e5, 14); y <- rchisq(1e5, 5)and computemean(abs(x - y) <= 11.5). A difference of chi-squares is not a chi-square (it can be negative): that is why it has to be simulated.
What if the library had twice the spread and only 5 pings?
The pooled-variance t assumes equal σs. With different σs and very different sizes, it stops keeping its 5 %. The means are still 40, so every t that falls outside is a false alarm:
set.seed(2026)
m <- 15; n <- 5 # few pings in the library
unequal <- function() {
a <- rnorm(m, 40, 6) # Computer Science: sigma = 6
b <- rnorm(n, 40, 12) # library: same mean, twice the spread
sp <- sqrt(((m - 1) * var(a) + (n - 1) * var(b)) / (m + n - 2))
(mean(a) - mean(b)) / (sp * sqrt(1 / m + 1 / n)) # the usual t
}
t_sim <- replicate(10000, unequal())
round(c(t_tails = mean(abs(t_sim) > qt(0.975, m + n - 2)), sd_t = sd(t_sim),
sd_theory = sqrt((m + n - 2) / (m + n - 4))), 2)
Output:
t_tails sd_t sd_theory
0.16 1.54 1.06
False alarms go from 5 % to 16 %: more than three times as many. The reason is in sd_t: the simulated t has a standard deviation of 1.54, and a would have . The pooled variance mixes the two variances giving more weight to Computer Science (14 degrees against 4): it ends up around . With that 60, the error of the difference comes out as , when the real one is . The denominator is too small and the t, too large. That is why, before using it, you check whether the variances look alike (the F) and, if not, you use the Welch t from ME2.
Common mistakes in this practice
dchisq(x, n)instead ofdchisq(x, n - 1). The curve sits to the right of the histogram of . That is the hook’s mistake.- Making the sample outside
replicate. All repetitions come out equal and the histogram is one bar. - Forgetting
freq = FALSE. The histogram comes out in frequencies (hundreds) and the density stays flat on the floor. - Swapping the F’s degrees.
qf(0.95, 11, 14)is notqf(0.95, 14, 11): the first is the top sample’s. - Using
qt(0.95, …)for two tails. To leave 5 % split,qt(0.975, …). - Not restoring
par(mfrow = c(1, 1)). The following plots come out in a small panel.
Try it in the R playground
Open the R playground on the site (or RStudio) and paste this script, which puts together the essentials of the three programs with the theory’s data:
compsci <- c(35.2, 41.2, 46.0, 47.7, 45.4, 43.0, 43.6, 30.5,
46.0, 53.1, 32.7, 36.5, 46.3, 38.1, 39.7)
library_ <- c(57.4, 52.9, 41.4, 37.3, 39.4, 47.8,
46.0, 52.9, 58.8, 47.4, 38.3, 46.2)
# Where do our statistics fall within their distribution?
u <- 14 * var(compsci) / 36 # chi^2(14) if sigma = 6
t1 <- sqrt(15) * (mean(compsci) - 40) / sd(compsci) # t(14) if mu = 40
f <- var(compsci) / var(library_) # F(14, 11) if equal sigmas
round(c(u = u, p_u = pchisq(u, 14), t = t1, p_t = pt(t1, 14), F = f, p_F = pf(f, 14, 11)), 3)
curve(dchisq(x, 14), 0, 40); abline(v = u, col = "red", lwd = 2)
Things to look at:
- That
p_u,p_tandp_F(the probability of staying below our value) are far from 0 and 1: none of the three statistics is unusual. - The red line: our falls in the middle of the .
- Change 40 to 46 in the t:
p_tdrops almost to 0. If IT Services said 46 ms in Computer Science, the pings would contradict them.
Summary
- The three families are drawn with
curve(dchisq/dt/df(x, …))and their exam quantiles come fromqchisq(0.95, k),qt(0.975, k)andqf(0.95, k1, k2). - To simulate a statistic: a function that makes the sample inside and returns what you want, plus
replicate. With a named vector, you get a matrix. - The simulated mean of 15 pings has standard deviation and its histogram goes with the normal; goes with the .
- With normal data, simulated means and variances have correlation close to 0.
- The ratio of variances of two samples goes with , and the pooled-variance t with .
- A curve that doesn’t fit its histogram is almost always the degrees of freedom.
Checklist: have you practised it?
- Can you draw several densities in one plot with
add = TRUEand several plots withpar(mfrow)? - Can you get χ², t and F quantiles for one and two tails?
- Have you simulated 10,000 means and variances with a function that makes the sample inside?
- Can you check with a histogram and
curvethat a statistic follows the theory’s distribution? - Have you run the three programs and checked the outputs?
- Have you tried the “Try it yourself” items without looking at the theory?
If you answered yes to almost everything, you’re ready for the sampling distributions exercises, where I no longer hand you the code. See you there!
Next step: exercisesSampling distributions — exam-style exercises with the Virtual Campus, a laptop battery and two printers (and the degrees of freedom I put the wrong way round)Did this article help you? Here is how you can support SergioLearns →



