Skip to main content

Section A.7 Chapter 7: The Sampling Distribution

Subsection A.7.1 Exercise 7.1

  1. After placing the file β€œpop2.csv" in the working directory one may produce a data frame with the content of the file and compute the average of the variable β€œbmi" using the code:
    pop.2 <- read.csv(file="_data/pop2.csv")
    mean(pop.2$bmi)
    
    ## [1] 24.98446
    
    We obtain that the population average of the variable is equal to 24.98446.
  2. Applying the function β€œsd" to the sequence of population values produces the population standard deviation:
    sd(pop.2$bmi)
    
    ## [1] 4.188511
    
    In turns out that the standard deviation of the measurement is 4.188511.
  3. In order to compute the expectation under the sampling distribution of the sample average we conduct a simulation. The simulation produces (an approximation) of the sampling distribution of the sample average. The sampling distribution is represented by the content of the sequence β€œX.bar":
    X.bar <- rep(0,10^5)
    for(i in 1:10^5) {
    X.samp <- sample(pop.2$bmi,150)
    X.bar[i] <- mean(X.samp)
    }
    mean(X.bar)
    
    ## [1] 24.98457
    
    Initially, we produce a vector of zeros of the given lenght (100,000). In each iteration of the β€œfor" loop a random sample of size 150 is selected from the population. The sample average is computed and stored in the sequence β€œX.bar". At the end of all the iterations all the zeros are replaced by evaluations of the sample average.
    The expectation of the sampling distribution of the sample average is computed by the application of the function β€œmean" to the sequence that represents the sampling distribution of the sample average. The result for the current is 24.98681, which is vary similar[^3] to the population average 24.98446.
  4. The standard deviation of the sample average under the sampling distribution is computed using the function β€œsd":
    sd(X.bar)
    
    ## [1] 0.3428704
    
    The resulting standard deviation is 0.3422717. Recall that the standard deviation of a single measurement is equal to 4.188511 and that the sample size is \(n=150\text{.}\) The ratio between the standard deviation of the measurement and the square root of 150 is \(4.188511/\sqrt{150} =0.3419905\text{,}\) which is similar in value to the standard deviation of the sample average[^4].
  5. The central region that contains 80% of the sampling distribution of the sample average can be identified with the aid of the function β€œquantile":
    quantile(X.bar,c(0.1,0.9))
    
    ##      10%      90% 
    ## 24.54655 25.42312
    
    The value 24.54972 is the 10%-percentile of the sampling distribution. To the left of this value are 10% of the distribution. The value 25.42629 is the 90%-percentile of the sampling distribution. To the right of this value are 10% of the distribution. Between these two values are 80% of the sampling distribution.
  6. The Normal approximation, which is the conclusion of the Central Limit Theorem substitutes the sampling distribution of the sample average by the Normal distribution with the same expectation and standard deviation. The percentiles are computed with the function β€œqnorm":
    qnorm(c(0.1,0.9),mean(X.bar),sd(X.bar))
    
    ## [1] 24.54516 25.42397
    
    Observe that we used the expectation and the standard deviation of the sample average in the function. The resulting interval is \([24.54817, 25.42545]\text{,}\) which is similar to the interval \([24.54972, 25.42629]\) which was obtained via simulations.

Subsection A.7.2 Exercise 7.2

  1. Denote by \(X\) the distance from the specified endpoint of a random hit. Observe that \(X \sim \mbox{Uniform}(0,10)\text{.}\) The 25 hits form a sample \(X_1, X_2, \ldots, X_{25}\) from this distribution and the sample average \(\bar X\) is the average of these random locations. The expectation of the average is equal to the expectation of a single measurement. Since \(\Expec(X) = (a + b)/2 = (0 + 10)/2 = 5\) we get that \(\Expec(\bar X) = 5\text{.}\)
  2. The variance of the sample average is equal to the variance of a single measurement, divided by the sample size. The variance of the Uniform distribution is \(\Var(X) = (a + b)^2/12 = (10-0)^2/12 = 8.333333\text{.}\) The standard deviation of the sample average is equal to the standard deviation of the sample average is equal to the standard deviation of a single measurement, divided by the square root of the sample size. The sample size is \(n=25\text{.}\) Consequently, the standard deviation of the average is \(\sqrt{8.333333/25}=0.5773503\text{.}\)
  3. The left-most third of the detector is the interval to the left of 10/3. The distribution of the sample average, according to the Central Limit Theorem, is Normal. The probability of being less than 10/3 for the Normal distribution may be computed with the function β€œpnorm":
    mu <- 5
    sig <- sqrt(10^2/(12*25))
    pnorm(10/3,mu,sig)
    
    ## [1] 0.001946209
    
    The expectation and the standard deviation of the sample average are used in computation of the probability. The probability is 0.001946209, about 0.2%.
  4. The central region in the \(\mbox{Normal}(\mu,\sigma^2)\) distribution that contains 99% of the distribution is of the form \(\mu \pm \mbox{\texttt{qnorm(0.995)}}\cdot \sigma\text{,}\) where β€œqnorm(0.995)" is the 99.5%-percentile of the Standard Normal distribution. Therefore, \(c =\mbox{\texttt{qnorm(0.995)}}\cdot \sigma\text{:}\)
    qnorm(0.995)*sig
    
    ## [1] 1.487156
    
    We get that \(c=1.487156\text{.}\)