Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Statistical Inference: Confidence Intervals and Hypothesis Testing for Means - Prof. Thoma, Study notes of Data Analysis & Statistical Methods

An explanation of how to estimate the population mean when the standard deviation is unknown, using the t-distribution and confidence intervals. It covers the assumptions for inference about a mean, the one-sample t statistic and confidence interval, and examples of calculating a confidence interval by hand and using spss. It also discusses the use of the t-distribution in hypothesis testing and the concept of robustness.

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-pvk
koofers-user-pvk 🇺🇸

10 documents

1 / 19

Toggle sidebar

Related documents


Partial preview of the text

Download Statistical Inference: Confidence Intervals and Hypothesis Testing for Means - Prof. Thoma and more Study notes Data Analysis & Statistical Methods in PDF only on Docsity!

Lecture 8, Sections 7.1 & 7. Inference for the Mean of a Population Previously we made the assumption that we know the population standard deviation, σ. We then developed a confidence interval and used tests for significance to gather evidence for/against an hypothesis, all with a known σ. In normal practice, σ is unknown. In this section, we must estimate σ from the data though we are primarily interested in the population mean, μ. Confidence Interval for a Mean First, Assumptions for Inference about a mean:  Our data are a simple random sample (SRS) of size n from the population.  Observations from the population have a normal distribution with mean μ and standard deviation σ. If population distribution is not normal, it is enough that the distribution is unimodal and symmetric and that the sample size be large (n>15). Both μ and σ are unknown parameters. Because we do not know σ we make two changes in our procedure.

1. The standard error, SEx^ , is used in place of

n

 . Standard Error: When the standard deviation of a statistic is estimated from the data, the result is called the standard error of the statistic. The standard error of the sample mean x is x

s

SE

n

Where s is the sample standard deviation, n is the sample size.

  1. We calculate a different test statistic and use a different distribution to calculate our p-value. Lecture 8, Section 7.1 & 7.

The t-distributions:  The t-distribution is used when we do not know σ. The t-distributions have density curves similar in shape to the standard normal curve, but with more spread.  The t-distributions have more probability in the tails and less in the center than does the standard normal. This is because substituting the estimate s for the fixed parameter σ introduces more variation into the statistic.  As the sample size increases, the t-density curve approaches the N(0,1) curve. (Note: This is because s estimates σ more accurately as the sample size increases). The t Distributions

Suppose that an SRS of size n is drawn from a N (^  ,^ ) population. Then

the one-sample t statistic

/

x

t

s n

 

has the t distribution with n-1 degrees of freedom. The One-Sample t Confidence Interval Suppose that an SRS of size n is drawn from a population having unknown mean μ. A level C confidence interval for μ is

s x t n  where t* is the value for the t ( n -1) density curve with area C between – t* and t*. This interval is exact when the population distribution is normal and is approximately correct for large n in other cases. Lecture 8, Section 7.1 & 7.

Examples:

  1. Suppose X, Bob’s golf scores, are approximately normal distribution with unknown mean and standard deviation. A SRS of n = 16 scores is selected and a sample mean of (^) x = 77 and a sample standard deviation of

s = 3 is calculated. Calculate a 90% confidence interval for^ ^.

  1. (Example 7.1 in Textbook) In 1996 the U.S. Agency for International Development provided 238,300 metric tons of corn soy blend (CSB) for development programs and emergency relief. CSB is highly nutritious, low-cost fortified food and can be incorporated into different food preparations worldwide. As part of a study to evaluate appropriate vitamin C levels in this commodity, measurements were taken on samples of CSB produced in a factory. The following data are the amounts of vitamin C, measured in milligrams per 100 grams of blend, for a random sample of size 8 from a production run. Compute a 95%

confidence interval for^ ^ where^ ^ is the mean vitamin C content of the

CSB.

By hand: x = 22.5^ s^ = 7.191^ n^ = 8 Lecture 8, Section 7.1 & 7.

Using SPSS: analyze > descriptive statistics > explore Move “vitaminC” to “dependent list”. Click “statistics” and select “descriptives” and change/keep a 95% confidence interval. Click “continue” followed by “OK”. Descriptives Statistic Std. Error Vitamin C Mean (^) 22.50 2. 95% Confidence Interval for Mean Lower Bound (^) 16. Upper Bound

5% Trimmed Mean (^) 22. Median (^) 22. Variance (^) 51. Std. Deviation (^) 7. Minimum (^11) Maximum (^31) Range (^20) Interquartile Range (^14) Skewness (^) -.443. Kurtosis (^) -.631 1. The One-Sample t test:

1. State the Null and Alternative hypothesis.

  1. Find the test statistic: Suppose that an SRS of size n is drawn from a population having unknown mean μ. To test the hypothesis H 0 :^ ^ ^0 based on a SRS of size n, compute the one-sample t statistic 0 / x t s n   
  2. Calculate the p -value. In terms of a random variable T having the t ( n- 1) distribution, the P -value for a test of H^ 0 against Ha :    0 is P T (  t ) Ha :    0 is P T (  t ) Ha :   (^0) is 2 P T ( | |) t These P -values are exact if the population distribution is normal and are approximately correct for large n in other cases. Lecture 8, Section 7.1 & 7.
  1. State the conclusions in terms of the problem. Choose a significance level such as α = 0.05, then compare the P -value to the α level. If P- value  α, then reject H 0

If P- value > α, then fail to reject H 0

Examples:

  1. Experiments on learning in animals sometimes measure how long it takes mice to find their way through a maze. The mean time is 18 seconds for one particular maze. A researcher thinks that a loud noise will improve/decrease the time it takes a mouse to complete the maze. She measures how long each of 30 mice take to complete the maze with noise stimulus. She finds their average time is 16 seconds and their standard deviation is s = 3 seconds. Do a hypothesis test to test the researchers assertions with α = 0.1.
  2. (Example 7.2 in Textbook) Suppose that we know that sufficient vitamin C was added to the CSB mixture to produce a mean vitamin C content in the final product of 40 mg/100 g. It is suspected that some of the vitamin is lost or destroyed in the production process. To test this hypothesis we can conduct a one-sided test to determine if there is sufficient evidence to conclude that the CSB mixture lost vitamin C content at α = 0.05 level. By hand: Lecture 8, Section 7.1 & 7.

Using SPSS: analyze > compare means > One sample T test Move “vitaminc” into the “test variable box” and type in 40 for the test value. To change the confidence interval, Click “options” and change confidence interval from 95% to whatever. I did not do this as I will keep the 95% default. Click “continue”. Lastly click “OK”. One-Sample Statistics N Mean Std. Deviation Std. Error Mean Vitamin C (^8) 22.50 7.191 2. One-Sample Test Test Value = 40 t df Sig. (2-tailed) Mean Difference 95% Confidence Interval of the Difference Lower Upper vitamin C (^) -6.883 7 .000 -17.500 -23.51 -11. Matched Pairs Design: Lecture 8, Section 7.1 & 7.

A common design to compare two treatments is the matched pairs design. One type of matched pair design has 2 subjects who are similar in important aspects matched in pairs and each treatment is given to one of the subjects in each pair. With only one subject, 2 treatments are given in random order. Another type of matched pairs is before-and after observations on the same subject. Paired t Procedures: To compare the mean responses to the two treatments in a matched pairs design, apply the one-sample t procedures to the observed differences, d. Example: (Problem 7.31 is done by hand and using SPSS): The researchers studying vitamin C in CSB in example 7.1 were also interested in a similar commodity called wheat soy blend (WSB). Both these commodities are mixed with other ingredients and cooked. Loss of vitamin C as a result of this process was another concern of the researchers. One preparation used in Haiti called gruel can be made from WSB, salt, sugar, milk, banana, and other optional items to improve the taste. Samples of gruel prepared in Haitian households were collected. The vitamin C content (in milligrams per 100 grams of blend, dry basis) was measured before and after cooking. Here are the results: Sample 1 2 3 4 5 Before 73 79 86 88 78 After 20 27 29 36 17 Set up appropriate hypotheses and carry out a significance test for these data. (It is not possible for cooking to increase the amount of vitamin C). Lecture 8, Section 7.1 & 7.

By hand: Using SPSS: > Analyze > Compare Means > Paired – Sample T test. Move “before and after” to “paired variable box” (whichever variable is listed first will come first in the subtraction) Click “OK” Paired Samples Statistics Mean N Std. Deviation Std. Error Mean Pair 1 Before 80.80 5 6.140 2. After (^) 25.80 5 7.530 3. Paired Samples Test Paired Differences Mean t df Sig. (2-tailed) Std. Deviation Std. Error Mean 95% Confidence Interval of the Difference Lower Upper Pair 1 before - after 55.000^ 3.937^ 1.761^ 50.112^ 59.888^ 31.238^4. Lecture 8, Section 7.1 & 7.

A confidence interval or statistical test is called robust if the confidence level or P - value does not change very much when the assumptions of the procedure are violated. The t procedures are robust against non-normality of the population when there are no outliers, especially when the distribution is roughly symmetric and unimodal. Robustness and use of the One-Sample t and Matched Pair t procedures:  Unless a small sample is used, the assumption that the data comes from a SRS is more important than the assumption that the population distribution is normal.  n<15: Use t procedures only if the data are close to normal with no outliers.  n>15: The t procedure can be used except in the presence of outliers or strong skewness.  n is large (n≥40): The t procedure can be used even for clearly skewed distributions. Lecture 9, Section 7.1 & 7.

Comparing Two Means: Two-Sample Problems: A situation in which two populations or two treatments based on separate samples are compared. A two-sample problem can arise:  from a randomized comparative experiment which randomly divides the units into two large groups and imposes a different treatment on each group.  From a comparison of random samples selected separately from different populations. Note: Do not confuse two-sample designs with matched pair designs! Assumptions for Comparing Two Means:  Two independent simple random samples, from two distinct populations are compared. The same variable is measured on both samples. The sample observations are independent, neither sample has an influence on the other.  Both populations are approximately normally distributed.

 The means  1 and  2 and standard deviations ^1 and ^2 of both populations

are unknown. Typically we want to compare two population means by giving a confidence interval

for their difference,  1 ^  2 , or by testing the hypothesis of no difference,

H 0 :  1   2  0.

The Two-Sample t Confidence Interval:

Suppose that an SRS of size n 1^ is drawn from a normal population with unknown

mean  1 and that an independent SRS of size n 2^ is drawn from another normal

population with unknown mean  2. The confidence interval for  1 ^  2 given by

2 2 1 2 1 2 1 2

( ) *

s s

x x t

n n

  

has confidence level at least C no matter what the population standard deviations may be. Here, t* is the value for the t ( k ) density curve with area C between – t* and t *. The value of the degrees of freedom k is approximated by software or we use the

smaller of n 1^ ^1 and n 2^ ^1.

Two-Sample t Procedure: Lecture 9, Section 7.1 & 7.

  1. Write the hypotheses in terms of the difference between means. H 0 (^) : u 1   2  0 Ha :  1   2  (^0) or Ha :  1   2  (^0) or Ha :  1   2  0
  2. Calculate the test statistic. A SRS of size^ n 1^ is drawn from a normal population with unknown mean  1 and draw an independent SRS of size^ n 2 from another normal population with unknown mean  2. To test the hypothesis H 0^ :^ u 1 ^  2 ^0 the two-sample t statistic is: 1 2 2 2 1 2 1 2 x x t s s n n    and use P -values or critical values for the t ( k ) distribution, where the degrees of freedom k are either approximated by software or are the smaller of n 1^ ^1 and n 2 (^)  (^1). Note: The two-sample t statistic does not have a t distribution. The software, however, uses a t distribution to do inference for two-sample problems. This is because it is approximately a t distribution with degrees of freedom calculated by a complex formula called the Welch Approximation.
  3. Calculate the P- value. Note: Unless we use software, we can only get a range for the P- value. We use the following formulas: Ha :  1   2  (^0) is P T (  t ) Ha :  1   2  (^0) is P T (  t ) Ha :  1   2  (^0) is 2 P T ( | |) t Note: Instead of using the degrees of freedom found by software, you can use the smaller of n 1^ ^1 and n 2^ ^1. The resulting procedure is conservative.
  4. State the conclusions in terms of the problem. Choose a significance level such as α = 0.05, then compare the P -value to the α level. If P- value  α, then reject H 0

If P- value > α, then fail to reject H 0

Robustness and use of the Two-Sample t Procedures : Lecture 9, Section 7.1 & 7.

The two-sample t procedures are more robust than the one-sample t methods, particularly when the distributions are not symmetric. They are robust in the following circumstances:  If two samples are equal and the two populations that the sample come from have similar distributions then the t distribution is accurate for a variety of

distributions even when the sample sizes are as small as n 1^  n^2 ^5.

 When the two population distributions are different, larger samples are needed.

 15

n  n  : Use two-sample t procedures if the data are close to normal. If

the data are clearly non normal or if outliers are present, do not use t.

 15

n  n  : The t procedures can be used except in the presence of outliers

or strong skewness. 

n  n  40 : The t procedures can be used even for clearly skewed

distributions. Examples: Lecture 9, Section 7.1 & 7.

  1. The U.S. Department of Agriculture (USDA) uses many types of surveys to obtain important economic estimates. In one pilot study they estimated wheat prices in July and in September using independent samples. Here is a brief summary from the report: Month n x s / n July 90 2.95 0. September 45 3.61 0. a. Note that the report gave standard errors. Find the standard deviation for each of the samples. b. Use a significance test to examine whether or not the price of wheat was the same in July and September. Be sure to give details and carefully state your conclusion. c. Give a 95% confidence interval for the increase in price between July and September. Lecture 9, Section 7.1 & 7.
  1. The survey for Study Habits and Attitudes (SSHA) is a psychological test designed to measure the motivation, study habits, and attitudes toward learning of college students. These factors, along with ability are important in explaining success in school. Scores on the SSHA range from 0 to 200. A selective private college gives the SSHA to an SRS of both male and female first-year students. The data for the women are as follows: 154 109 137 115 152 140 145 178 101 103 126 126 137 165 165 129 200 148 Here are the scores of the men: 108 140 114 91 180 115 126 92 169 146 109 132 75 88 113 151 70 115 187 104 a. Examine each sample graphically, with special attention to outliers and skewness. Is use of a t procedure acceptable for these data? Lecture 9, Section 7.1 & 7.
  • Lecture 9, Section 7.1 & 7.

b. Most studies found that the mean SSHA score for men is lower than the mean score in a comparable group of women. Test this supposition here. That is, state the hypotheses, carry out the test and obtain a P -value, and give your conclusions. Using SPSS: Note: The data needs to be typed in using two columns. In the first column you need to put all the scores. In the second column define the grouping variable as gender and enter “ women” next to the women’s scores and “men” next to the men’s scores. Analyze > Compare means > Independent Sample T test Move “score” to “Test Variable” box and “gender” to “grouping variable” box. Click “define groups” and enter “women” for group 1 and “men” for group 2. Click “continue” followed by “OK”. Group Statistics group N Mean Std. Deviation Std. Error Mean score women (^18) 140.56 26.262 6. men 20 121.25 32.852 7. Levene's Test for Equality of Variances t-test for Equality of Means F Sig. t df Sig. (2- tailed) Mean Differenc e Std. Error Differenc e 95% Confidence Interval of the Difference Lower Upper score Equal variances assumed 1.030 .317 1.986 36 .055 19.306 9.721 -.410 39. Equal variances not assumed 2.010 35.537 .052 19.306 9.606 -.185 38. Independent Samples Test We use the second line, “Equal variances not assumed” to get the t test statistic, p- value, etc. Lecture 9, Section 7.1 & 7.

c. Give a 95% confidence interval for the mean difference between the SSHA scores of male and female first-year students at this college.

  1. Suppose we wanted to compare how students performed on test 1 versus test 2 in stat 301. Below is data for a random sample of 10 students taking stat 301 along with the printout of the results from running the matched pairs test. Subject Test 1 Test 2 1 60 55 2 59 60 3 90 82 4 87 85 5 99 100 6 100 98 7 92 90 8 82 76 9 75 79 10 84 82 Paired Samples Statistics 82.80 10 14.382 4. 80.70 10 14.507 4. Test 1 Test 2 Pair 1 Mean N Std. Deviation Std. Error Mean Paired Samples Test Pair 1 Test 1 - Test 2 2.100 3.573 1.130 -.456 4.656 1.859 9. Mean Std. Deviation Std. Error Mean Lower Upper 95% Confidence Interval of the Difference Paired Differences t df Sig. (2-tailed) Answer the questions below based on the test.

Lecture 9, Section 7.1 & 7.

a. Why was a matched pairs test used as opposed to a two sample t- test? b. Is there a difference between test 1 and test 2 scores. Write out the hypotheses and give the P -value. Are our results significant at the 5% significance level? c. Suppose one of our friends thought test 2 was easier and the students generally did better on it. We want to test whether the student is correct. Write out the hypotheses to test this and give the P- value. Are our results significant at the 5% significance level?

  1. An instructor thought the material for the second test was more difficult and hence the students may have done worse on the second test. She decided to randomly sample 10 Exam 1 tests and 10 Exam 2 tests, with each sample taken from all the test taken. Below is data for the two random samples and the analysis. Sample Test 1 Sample Test 2 60 55 59 60 90 82 87 85 99 100 100 98 92 90 82 76 75 79 84 82 Lecture 9, Section 7.1 & 7.

Group Statistics 10 82.80 14.382 4. 10 80.70 14.507 4. test 1 2 score N Mean Std. Deviation Std. Error Mean Independent Samples Test .015 .905 .325 18 .749 2.100 6.460 -11.472 15. .325 17.999 .749 2.100 6.460 -11.472 15. Equal variances assumed Equal variances not assumed score F Sig. Levene's Test for Equality of Variances t df Sig. (2-tailed) Mean Difference Std. Error Difference Lower Upper 95% Confidence Interval of the Difference t-test for Equality of Means a. What procedure was used and why? b. Write out the hypotheses to test this and give the P- value. Are your results significant at the 5% significance level? Lecture 9, Section 7.1 & 7.