180 likes | 195 Vues
Happiness comes not from material wealth but less desire. Statistical Package Usage. Topic: Tests for two samples By Prof Kelly Fan, Cal State Univ, East Bay. Example: Mortar Strength.
E N D
Statistical Package Usage Topic: Tests for two samples By Prof Kelly Fan, Cal State Univ, East Bay
Example: Mortar Strength Unmodified modified16.85 17.5016.40 17.6317.21 18.2516.35 18.0016.52 17.8617.04 17.7516.96 18.2217.15 17.9016.59 17.9616.57 18.15
SAS Output The TTEST Procedure Statistics Lower CL Upper CL Lower CL Upper CL Variable FORMULATION N Mean Mean Mean Std Dev Std Dev Std Dev Std Err STRENGTH M 10 16.538 16.764 16.99 0.2177 0.3164 0.5777 0.1001 STRENGTH U 10 17.745 17.922 18.099 0.1705 0.2479 0.4526 0.0784 STRENGTH Diff (1-2) -1.425 -1.158 -0.891 0.2148 0.2843 0.4204 0.1271 Ho: The mean strength of the two formulations are the same H1: They are different
Types of Errors H0 true H0 false Type II Error, or “ Error” Good! (Correct!) we accept H0 Type I Error, or “ Error” Good! (Correct) we reject H0
= Probability of Type I error = P(rej. H0|H0 true) • = Probability of Type II error= P(acc. H0|H0 false) We often preset . The value of depends on the specifics of the H1 (and most often in the real world, we don’t know these specifics).
EXAMPLE: H0 : < 100 H1 : >100 Suppose the Critical Value = 141: X =100 C=141
= P (X < 141/= 150) = .3594 = 150 What is ? 141 = 150 = 160 These are values corresp.to a value of 25 for the Std. Dev. of X = P (X < 141/= 160) = .2236 = 160 141 = 170 = P (X < 141/= 170) = .1230 = 170 141 = 180 = P (X < 141/= 180) = .0594 = P (X < 141|H0 false) = 180 141
Note: Had been preset at .025 (instead of .05), C would have been 149 (and would be larger); had been preset at .10, C would have been 132 and would be smaller. and“trade off”.
P Value • The probability of seeing as extreme as or more extreme than what we observe, assuming Ho is true. • The smaller the p-value is, the stronger the evidence against Ho is.
One Population Non-parametric test
Two independent samples Non-parametric test
Normality Tests Tests for Normality Test --Statistic--- -----p Value------ Shapiro-Wilk W 0.918255 Pr < W 0.0917 Kolmogorov-Smirnov D 0.134926 Pr > D >0.1500 Cramer-von Mises W-Sq 0.081542 Pr > W-Sq 0.1936 Anderson-Darling A-Sq 0.537514 Pr > A-Sq 0.1503 SAS: PROC UNIVARIATE DATA=** NORMAL; Note: For demonstration purpose, here is the result for testing normality when treating 2 samples as a whole. But you should do the normality test for both samples separately.
Equal-variance Tests SAS: PROC TTEST DATA=** ;
Non-parametric Tests • One sample: Wilcoxon Signed-Rank Test (Included in the output of Proc Univariate) • Two samples: Wilcoxon Rank Sum Test (See p. 191) • Three or more samples: Kruskal-Wallis Test (Later)
Paired Samples • If the same set of sources are used to obtain data representing two populations, the two samples are called paired. The data might be paired: • As a result of the data from certain “before” and “after” studies • From matching two subjects to form “matched pairs”
Example: Repeated Measures • Each subject is measured twice: • Before treatment (control value) • After treatment (treatment value)
Tests for Paired Samples • Calculate the pair differences • Proceed as in one sample case Notes: • SAS: all variables must be included in data • SPSS: create/calculate all variables we need Notes: • SAS and SPSS can also conduct paired t-tests directly