#set document(title: "7.7 t-Interval for a Mean", author: "Rachel Webb") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 7.7#h(0.6em)t-Interval for a Mean === 7.7.1 Student’s T-Distribution A #strong[t-distribution] is another symmetric distribution for a continuous random variable. #figure(figph[Black-and-white portrait photograph of William Sealy Gosset, a man with round wire glasses and a mustache, wearing a three-piece tweed suit and tie.], alt: "Black-and-white portrait photograph of William Sealy Gosset, a man with round wire glasses and a mustache, wearing a three-piece tweed suit and tie.", caption: none) #link("https://en.Wikipedia.org/wiki/William_Sealy_Gosset")[Gosset] William Gosset was a statistician employed at Guinness and performed statistics to find the best yield of barley for their beer. Guinness prohibited its employees to publish papers so Gosset published under the name Student. Gosset’s distribution is called the Student’s t-distribution. A t-distribution is another special type of distribution for a continuous random variable. Properties of the t-distribution density curve: + Symmetric, Unimodal (one mode) Bell-shaped. + Centered at the mean μ = median = mode = 0. + The spread of a t-distribution is determined by the degrees of freedom which are determined by the sample size. + As the degrees of freedom increase, the t-distribution approaches the standard normal curve. + The total area under the curve is equal to 1 or 100%. #figure(figph[Four overlaid t-distribution curves centered at zero for d.f. = 3, 5, 15, and 50, showing that smaller degrees of freedom give a lower peak and thicker tails, while larger degrees of freedom approach the standard normal shape.], alt: "Four overlaid t-distribution curves centered at zero for d.f. = 3, 5, 15, and 50, showing that smaller degrees of freedom give a lower peak and thicker tails, while larger degrees of freedom approach the standard normal shape.", caption: none) Figure 7-7 Figure 7-7 shows examples of three different t-distributions with degrees of freedom of 1, 5 and 30. Note that as the degrees of freedom increase the distribution has a smaller standard deviation and will get closer in shape to the normal distribution. #examplebox("Example 1")[][ The t-critical value that has 5% of the area in the upper tail for n = 13. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[invT and tcdf without the INVT program] Both links open the t-distribution pre-loaded with df = 12: the first is the inverse mode with left-tail area 0.95 (the book's invT(0.95,12)), the second the upper-tail probability past 1.8399. Raise df and watch both answers slide toward the normal ones. - invT(0.95,12) = 1.782 - P(t \> 1.8399) = 0.0453 ] #solutionbox[ Use a t-distribution with the degrees of freedom, df = n – 1 = 13 – 1 = 12. Draw and shade the upper tail area as in Figure 7-8. Use the DISTR menu invT option. Note that if you have an older TI-84 or a TI-83 calculator you need to have the program INVT installed. For this function, you always use the area to the left of the point. If want 5% in the upper tail, then that means there is 95% in the bottom tail area. t#sub[α] = invT(area below t-score, df) = invT(0.95,12) = 1.782 #figure(figph[t-distribution curve with the right tail shaded green and labeled α = 0.05 = area in upper tail, the body labeled Area = 1 − α = 0.95, and the caption The critical value is tα = 1.782.], alt: "t-distribution curve with the right tail shaded green and labeled α = 0.05 = area in upper tail, the body labeled Area = 1 − α = 0.95, and the caption The critical value is tα = 1.782.", caption: none) #figure(figph[TI-84 calculator screen showing the command invT(0.95,12) returning 1.782287494.], alt: "TI-84 calculator screen showing the command invT(0.95,12) returning 1.782287494.", caption: none) You can download the INVT program to your calculator from #link("http://mostlyharmlessstatistics.com/")[http://MostlyHarmlessStatistics.com] or use Excel =T.INV(0.95,12) = 1.7823. ] ] #examplebox("Example 2")[][ Compute the probability of getting a t-score larger than 1.8399 with a sample size of 13. #solutionbox[ To find the P(t \> 1.8399) on the TI calculator, go to DISTR use tcdf(lower,upper,df). For this example, we would have tcdf(1.8399,∞,12). In Excel use =1-T.DIST(1.8399,12,TRUE) = 0.0453. P(t \> 1.8399) = 0.0453. #figure(figph[t-distribution curve with the region to the right of the critical value shaded green and labeled Area = 0.0453; the caption reads The critical value is tα = 1.8399.], alt: "t-distribution curve with the region to the right of the critical value shaded green and labeled Area = 0.0453; the caption reads The critical value is tα = 1.8399.", caption: none) Figure 7-9 #figure(figph[TI-84 calculator screen showing the command tcdf(1.8399,1E99,12) returning .0453186864.], alt: "TI-84 calculator screen showing the command tcdf(1.8399,1E99,12) returning .0453186864.", caption: none) ] ] === 7.7.2 T-Confidence Interval Note that we rarely have a calculation for the population standard deviation so in most cases we would need to use the sample standard deviation as an estimate for the population standard deviation. If we have a normally distributed population with an unknown population standard deviation then the sampling distribution of the sample mean will follow a t-distribution. #figure(figph[Flowchart starting from the question Is σ known? The Yes branch says use the zα/2 values and σ in the formula; the No branch says use the tα/2 values and s in the formula. A footnote adds that if n \< 30, the variable must be normally distributed.], alt: "Flowchart starting from the question Is σ known? The Yes branch says use the zα/2 values and σ in the formula; the No branch says use the tα/2 values and s in the formula. A footnote adds that if n < 30, the variable must be normally distributed.", caption: none) Figure 7-10 #strong[A 100(1 - #math.equation(block: false, alt: "α")[$α$])% Confidence Interval for a Population Mean μ: (σ unknown)] Choose a simple random sample of size n from a population having #emph[unknown]mean μ. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ The 100(1 - #math.equation(block: false, alt: "α")[$α$])% confidence interval estimate for μ is given by #math.equation(block: false, alt: "x bar ± t sub α / 2 , n minus 1 open parenthesis the fraction s over the square root of n close parenthesis")[$overline(x) ± t_(α / 2 , n − 1) ( frac(s, sqrt(n)) )$]. The #emph[df] = degrees of freedom\* are #emph[n] – 1. ] The degrees of freedom are the number of values that are free to vary after a sample statistic has been computed. For example, if you know the mean was 50 for a sample size of 4, you could pick any 3 numbers you like, but the 4#super[th] value would have to be fixed to have the mean come out to be 50. For this class we just need to know that degrees of freedom will be based on the sample size. The sample mean #math.equation(block: false, alt: "x bar")[$overline(x)$] is the point estimate for μ, and the margin of error is #math.equation(block: false, alt: "t sub α / 2 open parenthesis the fraction s over the square root of n close parenthesis")[$t_(α / 2) ( frac(s, sqrt(n)) )$]. Where t#sub[#math.equation(block: false, alt: "α")[$α$]/2] is the positive critical value on the t-distribution curve with #emph[df] = #emph[n] – 1 and area 1 – #math.equation(block: false, alt: "α")[$α$] between the critical values –t#sub[#math.equation(block: false, alt: "α")[$α$]/2] and +t#sub[#math.equation(block: false, alt: "α")[$α$]/2], as shown in Figure 7-11. #figure(figph[t-distribution curve with both tails shaded green and labeled: area in lower tail = α/2, middle area = 1 − α, and area in upper tail = α/2, with the tail boundaries marked −tα/2 and tα/2 on the axis.], alt: "t-distribution curve with both tails shaded green and labeled: area in lower tail = α/2, middle area = 1 − α, and area in upper tail = α/2, with the tail boundaries marked −tα/2 and tα/2 on the axis.", caption: none) Figure 7-11 Before we compute a t-interval we will practice getting t critical values using Excel and the TI calculator’s built in t-distribution. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Get the t critical value for each interval] The first link reproduces invT(0.95,9) for the 90% interval with n = 10 -- the curve is symmetric, so the pair is +/-1.833. The second gives the 99%, df = 7 value the salary example uses: the area left of +t is 1 - 0.01/2 = 0.995. - invT(0.95,9) = 1.833 - invT(0.995,7) = 3.4995 ] #examplebox("Example 3")[][ Compute the critical values –t#sub[#math.equation(block: false, alt: "α")[$α$]/2] and +t#sub[#math.equation(block: false, alt: "α")[$α$]/2] for a 90% confidence interval with a sample size of 10. #solutionbox[ Draw and t-distribution with #emph[df] = #emph[n] – 1 = 9, see Figure 7-12. In Excel use =T.INV(lower tail area, #emph[df]) =T.INV(0.95,9) or in the TI calculator use invT(lower tail area, #emph[df]) = invT(0.95,9). The critical values are t = ±1.833 #figure(figph[t-distribution curve with the tails beyond −1.833 and 1.833 shaded green, each tail labeled α/2 = 0.05, and the middle labeled Area = 1 − α = 0.90.], alt: "t-distribution curve with the tails beyond −1.833 and 1.833 shaded green, each tail labeled α/2 = 0.05, and the middle labeled Area = 1 − α = 0.90.", caption: none) Figure 7-12 #figure(figph[TI-84 calculator screen showing the command invT(.95,9) returning 1.833112923.], alt: "TI-84 calculator screen showing the command invT(.95,9) returning 1.833112923.", caption: none) We can use Excel to find the margin of error when raw data is given in a problem. The following example is first done longhand and then done using Excel’s Data Analysis Tool and the T-Interval shortcut key on the TI calculator. ] ] #examplebox("Example 4")[][ The yearly salary for mathematics assistant professors are normally distributed. A random sample of 8 math assistant professor’s salaries are listed below in thousands of dollars. Estimate the population mean salary with a 99% confidence interval. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[The salary interval from the raw data] Both links carry the eight salaries in L1: run 1-Variable Stats for the book's x-bar = 69.7125 and s = 4.4483, then in the confidence-intervals panel choose the T-Interval on L1, set the level to 99%, and confirm (64.2088, 75.2162). Drop to 95% and watch the interval narrow. - 1-Var Stats: x-bar = 69.7125, s = 4.4483 - T-Interval at 99%: (64.2088, 75.2162) ] 66.0 75.8 70.9 73.9 63.4 68.5 73.3 65.9 #solutionbox[ First find the t critical value using #emph[df] = #emph[n] – 1 = 7 and 99% confidence, t#sub[#math.equation(block: false, alt: "α")[$α$]/2] = 3.4995. #figure(figph[TI-84 calculator screen showing the command invT(.995,7) returning 3.499483292.], alt: "TI-84 calculator screen showing the command invT(.995,7) returning 3.499483292.", caption: none) Then use technology to find the sample mean and sample standard deviation and substitute the numbers into the formula. #math.equation(block: true, alt: "x bar ± t sub α / 2 , n minus 1 open parenthesis the fraction s over the square root of n close parenthesis ⇒ 69.7125 ± 3.4995 open parenthesis the fraction 4.4483 over the square root of 8 close parenthesis ⇒ 69.7125 ± 5.5037 ⇒ open parenthesis 64.2088 , 75.2162 close parenthesis")[$overline(x) ± t_(α / 2 , n − 1) ( frac(s, sqrt(n)) ) ⇒ 69.7125 ± 3.4995 ( frac(4.4483, sqrt(8)) ) ⇒ 69.7125 ± 5.5037 ⇒ ( 64.2088 , 75.2162 )$] The answer can be given as an inequality 64.2088 \< µ \< 75.2162 or in interval notation (64.2088, 75.2162). We are 99% confident that the interval 64.2 and 75.2 contains the true population mean salary for all mathematics assistant professors. We are 99% confident that the mean salary for mathematics assistant professors is between \$64,208.80 and \$75,216.20. Assumption: The population we are sampling from must be normal\* or approximately normal, and the population standard deviation σ is unknown. \*This assumption #strong[must be] addressed before using statistical inference for sample sizes of under 30. #strong[TI-84:] Press the \[STAT\] key, arrow over to the \[TESTS\] menu, arrow down to the \[8:TInterval\] option and press the \[ENTER\] key. Arrow over to the \[Stats\] menu and press the \[ENTER\] key. Then type in the mean, sample standard deviation, sample size and confidence level, arrow down to \[Calculate\] and press the \[ENTER\] key. The calculator returns the answer in interval notation. Be careful. If you accidentally use the \[7:ZInterval\] option you would get the wrong answer. #emph[Alternatively] (If you have raw data in list one) Arrow over to the \[Data\] menu and press the \[ENTER\] key. Then type in the list name, L#sub[1], leave Freq:1 alone, enter the confidence level, arrow down to \[Calculate\] and press the \[ENTER\] key. #strong[TI-89:]Go to the \[Apps\] #strong[Stat/List Editor], then press \[2#super[nd]\] then F7 \[Ints\], then select #strong[2:TInterval]. Choose the input method, data is when you have entered #strong[data]into a list previously or #strong[stats]when you are given the mean and standard deviation already. Type in the mean, standard deviation, sample size (or list name (list1), and Freq: 1) and confidence level, and press the \[ENTER\] key. The calculator returns the answer in interval notation. Be careful: If you accidentally use the \[1:ZInterval\] option you would get the wrong answer. #strong[Excel Directions] Type the data into Excel. Select the Data Analysis Tool under the Data tab. #figure(figph[Excel column A holding the eight salary values 66, 75.8, 70.9, 73.9, 63.4, 68.5, 73.3, and 65.9.], alt: "Excel column A holding the eight salary values 66, 75.8, 70.9, 73.9, 63.4, 68.5, 73.3, and 65.9.", caption: none) Select Descriptive Statistics. Select OK. #figure(figph[Excel Data tab with the Data Analysis dialog open over the salary data; the Analysis Tools list includes Anova, Correlation, and Covariance options with Descriptive Statistics highlighted and OK, Cancel, and Help buttons on the right.], alt: "Excel Data tab with the Data Analysis dialog open over the salary data; the Analysis Tools list includes Anova, Correlation, and Covariance options with Descriptive Statistics highlighted and OK, Cancel, and Help buttons on the right.", caption: none) Use your mouse and click into the Input Range box, then select the cells containing the data. If you highlighted the label then check the box next to Labels in first row. In this case no label was typed in so the box is left blank. (Be very careful with this step. If you check the box and do not have a label then the first data point will become the label and all your descriptive statistics will be incorrect.) Check the boxes next to Summary statistics and Confidence Level for Mean. Then change the confidence level to fit the question. Select OK. The table output does not find the confidence interval. However, the output does give you the sample mean and margin of error. The margin of error is the last entry labeled Confidence Level. To find the confidence interval subtract and add the margin of error to the sample mean to get the lower and upper limit of the interval in two separate cells. #figure(figph[Excel Descriptive Statistics dialog with Input Range \$A\$1:\$A\$8, Grouped By set to Columns, Output Range \$C\$1, Summary statistics checked, and Confidence Level for Mean checked and set to 99%.], alt: "Excel Descriptive Statistics dialog with Input Range $A$1:$A$8, Grouped By set to Columns, Output Range $C$1, Summary statistics checked, and Confidence Level for Mean checked and set to 99%.", caption: none) The following screenshot shows the cell references to find the lower limit as =D3-D16 and the upper limit as =D3+D16. Make sure to put your answer in interval notation. #figure(figph[Excel Descriptive Statistics output for the salary data: Mean 69.7125, Standard Error 1.5727, Median 69.7, Standard Deviation 4.4483, Range 12.4, Minimum 63.4, Maximum 75.8, Sum 557.7, Count 8, and Confidence Level(99.0%) 5.5036, with adjacent cells showing the limit formulas =D3-D16 and =D3+D16.], alt: "Excel Descriptive Statistics output for the salary data: Mean 69.7125, Standard Error 1.5727, Median 69.7, Standard Deviation 4.4483, Range 12.4, Minimum 63.4, Maximum 75.8, Sum 557.7, Count 8, and Confidence Level(99.0%) 5.5036, with adjacent cells showing the limit formulas =D3-D16 and =D3+D16.", caption: none) The answer is given as an inequality 64.2088 \< µ \< 75.2162 or in interval notation (64.2088, 75.2162). We are 99% confident that the interval 64.2 and 75.2 contains the true population mean salary for all mathematics assistant professors. ] ] === Summary A t-confidence interval is used to estimate an unknown value of the population mean for a single sample. We need to make sure that the population is normally distributed or the sample size is 30 or larger. Once this is verified we use the interval #math.equation(block: false, alt: "x bar minus t sub α / 2 , n minus 1 open parenthesis the fraction s over the square root of n close parenthesis less than μ less than x bar plus t sub α / 2 , n minus 1 open parenthesis the fraction s over the square root of n close parenthesis")[$overline(x) − t_(α / 2 , n − 1) ( frac(s, sqrt(n)) ) < μ < overline(x) + t_(α / 2 , n − 1) ( frac(s, sqrt(n)) )$] to estimate the true population mean. Most of the time we will be using the t-interval, not the z-interval, when estimating a mean since we rarely know the population standard deviation. It is important to interpret the confidence interval correctly. A general interpretation where you would change what is in the parentheses to fit the context of the problem is: “One can be 100(1 – #math.equation(block: false, alt: "α")[$α$])% confident that between (lower boundary) and (upper boundary) contains the population mean of (random variable in words using context and units from problem).”