Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Introduction to the Statistical Analysis Using SPSS Lecture # 2 By: Dr. Nahed Mohammad Hilmy Department of Statistical and Operations Research T-Test Hypothesis testing involves making a decision concerning some hypothesis or statement about a population parameter such as the population mean, using the sample mean, X to decide whether this statement about the value of is valid or not. The steps of the hypothesis testing : 1- The first step is to formulate a null hypothesis written H 0 . The statement for H 0 is usually expressed as an equation or inequality as follows: H 0: given value H 0: given value H 0: given value 2 Also in this step it is stated an alternative hypothesis, written H a , a statement that indicates the opinion of the conductor of the test as to the actual value of . H a is expressed as follows: H a: given value H a: given value H a: given value We conduct a hypothesis test on a given value to find out if actual observation would lead us to reject the stated value. 3 T-Test The alternative hypothesis suggests the direction of the actual value of the parameter relative to the stated value. The statement of H a in the form of an inequality that indicates that the investigator has no opinion as to whether the actual value of is more than or less than the stated value but the feeling is that the stated value is incorrect. In this case the test is two-tail test. Statements in the form of strictly greater than or strictly less than relationship indicate that the investigator has an opinion as to the direction of the value of the parameter relative to the stated value. In this case it is called one-tail test. 4 T-Test 2- State the level of significance of the test and the corresponding Z values (for large sample tests), or the corresponding T values ( for small sample tests). The hypothesis test is frequently conducted at the 5%, 1% and 10% levels of significance. Some can use the Z values. For a test conducted at any other level of significance, we simply use the normal distribution table to determine a corresponding Z value. 3- Calculate the test statistic for the sample that has taken. There are three cases: 5 T-Test Case 1: The variable has a normal distribution and 2 is known. In this case the test statistic is Z x 0 n which has a standard normal distribution if 0 in H 0. 2 Case 2: The variable has a normal distribution and is unknown. The test statistic is x 0 Z S n which has a t n 1distribution if H 0 is true. 6 T-Test Case 3: The variable is not normal but n is large (which n>30), 2 may be known or unknown. The test statistic is Z x 0 if 2 is known n x 0 or Z if 2 is unknown s n By central limit theorem it has approximately standard normal distribution (0,1) if H 0 is true. 7 T-Test 4- Determine the boundary (or boundaries) for the area of rejection regions using either X c or Z c values. A critical value is the boundary or limit value that requires as to reject the statement of the null hypothesis. 8 T-Test Rejection region Lower X C Rejection region upper XC In directional test there are two critical values when: H a : o 9 T-Test Rejection region upper XC In directional test there is one critical value (upper boundary ) when: H a : o 10 T-Test Rejection region Lower XC In directional test there is one critical value (lower boundary ) when: H a : o 11 The critical value X is simply the maximum or minimum value that we are willing to accept as being consistent with the stated parameter . The mean of the distribution is given by: x The standard deviation of the distribution is given by: x n 5- Formulate a decision rule on the basis of the boundary values obtained in step 4. When we conduct an hypothesis test, we are required to make one of two decisions: a- Reject Ho or B- Accept Ho 12 It is possible to make two errors in decision . One error is called a type I error or error .We make a type I error whenever we reject the statement of H 0 ,when is in fact true. The probability of making a type I error is the level of significance of the test. The second error we can make in an hypothesis test is called a type II error, or Berror. We commit a type II error if we fail to reject the statement of ,when is in fact false. The four combinations H 0 of truth values of and the resulting decisions are H 0 summarizing below: 13 H 0 H 0 True False Reject Type I Correct H 0 error Decision Accept Correct Type II H Decision error 0 14 When we lower the level of significance of an hypothesis test we always increase the possibility of committing a B-error. 6- State a conclusion for the hypothesis test based on the sample data obtained and the decision rule stated in steps. 15 P-value of a test: The p- value is the probability of getting a value more extreme than one observed value of the test statistic, it is denoted by Z When H is as follows: H a obs a P-value= 2p (Z >| Z obs |) When H a is :> p-value= p (Z > Z obs ) When H a is :< P-value = p (Z < Z obs ) 16 If we have a T statistic with a t n 1 distribution and observe value t , these p-values becomes: obs >| t obs |) alternative :p-value = 2p (t n 1 > alternative :p-value = p ( t n 1 > t obs ) < alternative :p-value = p( t < t ) n 1 obs 17 Thus H is rejected if p-value < . When data is o collected from a normally distributed population and the sample size is small, the t values of the student t distribution must be used in the hypothesis test not the Z values of the normal distribution. This is due to the fact that her central limit theorem does not apply when n < 30. 18 Ex: Suppose we measure the sulfur content (as a percent) of 15 samples of crude oil from a particular Middle Eastern area obtaining: 1.9,2.3,2.9,2.5,2.1,2.7,2.8,2.6,2.6,2.5,2.7,2.2,2.8,2.7,3. Assume that sulfur content are normally distributed . Can we conclude that the average sulfur content in this area is less than 2.6? Use a level of significance of .05. 19 n 15 X 2.533 S .3091 .05 H 0 : 2.6 H a : 2.6 20 Rejection region .95 .05 -1.6 21 One-Sample Statistics N X 15 Mean 2.5533 Std. Error Std. Deviation Mean .3091 7.980E-02 22 One-Sample Test Test Value = 2.6 X t -.585 Mean df Sig. (2-tailed) Difference 14 .568 -4.667E-02 95% Confidence Interval of the Difference Lower Upper -.2178 .1245 23 Testing for the Difference in Two Population means: Often we have two populations for which we would like to compare the means. Independent random samples of sizes n1 and n 2 are selected from the two populations with no relationship between the elements we drawn from the two populations. The statistical hypothesis are given by: 24 H 0 : 1 2 vs H a : 1 2 or H a : 1 2 or H a : 1 2 25 There are three cases which depend on what is known about the the population variances. 12 and 22 Case1: Population variances are known for normal populations (or non normal populations with both n1and n 2 large). In this case the test statistic is to be : Z X1 X 2 12 n1 2 2 n2 26 Case2: Populations are unknown but are to be equal 12 22 2 in normal populations. In this case, we pool our estimates to get the pooled two- sample variance ( n1 1) S12 ( n2 1) S 22 2 S p n1 n2 2 27 And the test statistic is to be T Which has a X1 X 2 1 1 2 Sp( ) n1 n2 t n n 2 1 2 distribution if H 0 is true. 28 Case 3: 1 2 are unknown and unequal normal 2 and 2 populations . In this case the test statistic is given by: T X1 X 2 S12 n1 2 S2 n2 which does not have a known distribution. 29 Ex: The amount of solar ultraviolet light of wavelength from 290 to 320 nm which reached the earths surface in the Riyadh area was measured for independent samples of days in cooler months (October to March) and in warmer months (April to September): Cooler:5.31,4.36,3.71,3.74,4.51,4.58,4.64,3.83,3.16,3.67,4.34,2.95, 3.62,3.29,2.45. Warmer:4.07,3.83,4.75,4.84,5.03,5.48,4.11,4.15,3.9,4.39,4.55,4.91, 4.11,3.16,2.99,3.01,3.5,3.77. 30 Assuming normal distributions with equal variances , test whether there is a difference in the average ultraviolet light reaching Riyadh in the cooler and warmer months . Use a level of significance of .05. 31 n 1 X 15 n 1 3.877 S1 2 X2 .751 S2 H0 : 1 2 Ha : 1 2 18 4.142 .709 32 The pooled two sample variance is 2 ( n1 1) S1 ( n 1 ) S 2 2 2 2 S .531 p n1 n2 1 And the test statistic is to be T X1 X 2 S 2p ( 1 n1 1.033 1 ) n2 33 .95 .025 .025 t 31.025 2.0423 t 31, 025 2.0423 34 Group Statistics VAR00001 VAR00002 1.00 2.00 N 15 18 Mean 3.8773 4.1417 Std. Deviation .7507 .7088 Std. Error Mean .1938 .1671 35 Independent Samples Test Levene's Test for Equality of Variances F VAR00001 Equal variances assumed Equal variances not assumed .091 Sig. .764 t-test for Equality of Means t Mean Sig. (2-tailed) Difference df Std. Error Difference 95% Confidence Interval of the Difference Lower Upper -1.039 31 .307 -.2643 .2545 -.7834 .2548 -1.033 29.238 .310 -.2643 .2559 -.7875 .2588 36 Since the value of the test statistic is in the acceptance region , then H 0 is accepted at 05 . It means that there is no difference in the average ultraviolet light reaching Riyadh in the cooler and warmer months . 37 Dependent Samples: The method of comparing parameters of populations using paired dependent samples requires that we pair the items of data as we sample them from the two populations. .Further more , the size of the two populations selected from both populations is the same, that is n 1 n 2 n 38 For each X (the elements of the sample before the i Y experiment) and i (the elements of the sample after the experiment) we obtain in the two samples, we compute a value d of a random variable D which represents the i difference between the two populations and n is the number of items of data obtained in each of the two samples . 39 The samples drawn from the two populations are therefore converted to single sample –a sample of d i ' s The mean , d , and the standard deviation, S , of the d distribution of d i ' s are obtained as follows: d di ( xi n Sd yi ) n ( di d )2 n 1 40 We are interested in testing one of the tests of hypothesis: H 0 : d 0 T H a : d 0 or H a : d 0 or H a : d 0 Thus the quantity d vs d Sd n has a t n 1 distribution. 41 Ex: In an experiment comparing two feeding methods for calves, eight pairs of twins were used-one twin receiving Method A and the other twin receiving Method B. At the end of a given time, the calves were slaughtered and cooked, and the meat was rated for its taste (with a higher number indicating a better taste 42 Twin pair 1 2 3 4 5 6 7 8 Method A 27 37 31 38 29 35 41 37 Method B 23 28 30 32 27 29 36 31 43 Assuming approximate normality, test if the average taste score for calves fed by Method B is less than the average .05A. Use taste for calves fed by Method . 44 d i 4 9 1 6 2 6 5 6 39 d 2 i 16 81 1 36 4 36 25 36 235 45 H 0 : d 0 d di Sd n 1 ( n vs H a : d 0 4.875 d i2 n d 2 ) 2.542 46 The test statistic is T d d 5.447 Sd n 47 .95 rejection region .05 t n 1, 1.8946 48 Paired Samples Statistics Pair 1 VAR00001 VAR00002 Mean 34.3750 29.5000 N 8 8 Std. Deviation 4.8679 3.8173 Std. Error Mean 1.7211 1.3496 49 Paired Samples Correlations N Pair 1 VAR00001 & VAR00002 Correlation 8 .857 Sig. .007 50 Paired Samples Test Paired Differences Pair 1 VAR00001 - VAR00002 Std. Error Mean Std. Deviation Mean 4.8750 2.5319 .8952 95% Confidence Interval of the Difference Lower Upper 2.7582 6.9918 t 5.446 df Sig. (2-tailed) 7 .001 51 Quality Control A “defect” is an instance of a failure to meet a requirement imposed on a unit with respect to single quality characteristic . In inspection or testing , each unit is checked to see if it does or dose not contain any defects. For example , if every dosage unit could be tested , the expense would probably be prohibitive both to manufacturer and consumer. Also it is may cause misclassification of items and other errors . Quality can be accurately and precisely estimated by testing only part of the total material (a sample) .It requires small samples for inspection or analysis . 52 Data obtained from this sampling can then be treated statistically to estimate population parameters. After inspection (n) units we will have found say (d) of them to be defectives and (n - d) of them to be good ones. On the other hand we may count and record the number of defects, c, we find on single unit. This count may be 0,1,2,…. Such an approach of counting of defects on a unit becomes especially useful if most of the units contain one or more defects. 53 Control charts can be applied during in - process manufacturing operations, for finished product characteristics and in research and development for repetitive procedures.We may always convert a measurable characteristics of a unit to an attribute by setting limits, say L (lower bound) and U (upper bound) for x. Then if x lies between, the unit is a good one, or if outside, it is a defective one. As an example for the control chart the tablet weight. 54 We are interested in ensuring that tablet weight remain close to a target value under “statistical control”. To achieve this object , we will periodically sample a group of tablets, measuring the mean weight and variability. Variability can be calculated on the basis of the standard deviation or the range. The range is the difference between the lowest and highest value. 55 If the sample size is not large (<10) the range is an efficient estimator of the standard deviation. The mean weight and variability of each sample (subgroup) are plotted sequentially as a function of time. The control chart is a graph that has time or order of submission of sequential lots on the x axis and the average test result on the Y axis. The subgroups should be as homogeneous as possible relative to overall process. They are usually ( but not always) taken as units manufactured close in time. 56 Four to five items per subgroup is usually as adequate sample size. In our example (10) tablets are individually weighted at approximately (1) hour intervals. The mean and range are calculated for each of the subgroups samples. As long as the mean and range of the 10 tablet samples do not vary “ too much” from subgroup to subgroup, the product is considered to be in control (it means that the observed variation is due only to the random, uncontrolled variation inherent in the process). 57 We will define upper and lower limits for the mean and range of the subgroups. The construct of these limits is based on normal distribution. In particular, a value more than (3) standard deviations from the mean is highly unlikely and can be considered to be probably due to some systematic, assignable cause. The average line (the target value) may be determined from the history of the product regular updating or may be determined from the product specifications . 58 The action lines (the limits) are constructed to represent 3 limits) from the 3 standard deviations ( target value. The upper and lower limits for the mean X chart are given by: X AR , R R K is the average range , K is the number of samples (subgroups).A is a factor which is obtained from a table according to the sample size . 59 The central line, the upper and lower limits for the range chart are given by: Central line = R R K Lower limit = D Upper limit = L R D R U 60 Where D and D are factors which are L U obtained from a table according to the sample size. It is noticed that the sample size is constant. Ex: Tablet weights and ranges from a tablet Manufacturing Process (Data are the average and range of 10 tablets): 61 Date Time Mean X 3/1 11 a.m. 12 p.m. 302.4 298.4 1 p.m. 2 p.m. 11 a.m. 300.2 299 300.4 Range R 16 13 10 9 13 12 p.m. 302.4 300.3 299 5 12 17 3/5 1 p.m. 2 p.m. 62 Date Time Mean Range R X 3/9 3/11 11 a.m. 12 p.m. 1 p.m. 300.8 301.5 301.6 18 6 7 2 p.m. 11 a.m. 12 p.m. 301.3 301.7 303 8 12 9 1 p.m. 2 p.m. 300.5 299.3 9 11 63 Date Time Mean X Range R 3/16 11 a.m. 12 p.m. 1 p.m. 300 299.1 300.1 13 8 8 2 p.m. 11 a.m. 12 p.m. 303.5 297.2 296.2 10 14 9 1 p.m. 2 p.m. 297.4 296 11 12 3/22 64 X chart The central line ( the t arg et value) is X 300 A .31 at n 10, R 10.833 L , U X A R 300 (.31)(10.833) 300 3.358 Lower Limit 296.642 Upper Limit 303.358 65 R chart The central line R 10.833 D L .22, D U 1.78 Lower Limit D L Upper Limit D U at n 10 R 2.383 R 19.283 66 X 304 302 U c L=303.358 C L=300 300 L c L=296.642 298 296 294 292 290 3\1 3\5 3\9 3\11 3\16 3\22 67 R U c L=19.283 18 16 14 12 C L=10.833 10 8 6 4 L c L=2.383 3\1 3\5 3\9 3\11 3\16 3\22 68