Aoucemets MidtermII Review Sta 101 - Fall 2016 Duke Uiversity, Departmet of Statistical Sciece Office Hours Wedesday 12:30-2:30pm Watch liear regressio videos before lab o Thursday Dr. Abrahamse Slides posted at https://stat.duke.edu/courses/fall16/sta101.002 1 Midterm 2 Exam Format Whe: Wedesday, November 9 - I class What to brig: Scietific calculator (graphig calculator ok, No Phoes!) Cheat sheet (ca be typed) Provided: Z, t ad χ 2 tables Covers HT from Uit 3, Uits 4 ad Uit 5 3 writte questios 70 pts 10 multiple choice questios - 3pts each 2 3
Uit 4.1 - Iferece for Numerical Variables What should you kow? Two mea testig problems Idepedet meas Paired (depedet) meas Coditios Idepedece Approximate Normality 4 5 All other details of the iferetial framework is the same... Oe mea: df = 1 HT: H 0 : µ = µ 0 T df = x µ s CI: x ± t df s HT : test statistic = poit estimate ull SE CI : poit estimate ± critical value SE Paired meas: df = diff 1 HT: H 0 : µ diff = 0 T df = x diff 0 s diff CI: x diff ± t df diff s Idepedet meas: df = mi( 1 1, 2 1) HT: H 0 : µ 1 µ 2 = 0 T df = x 1 x 2 s 2 1 + s2 2 1 2 CI: x 1 x 2 ± t df s 2 1 1 + s2 2 2 Clicker questio A study examiig the relatioship betwee weights of school childre ad abseces foud a 95% cofidece iterval for the differece betwee the average umber of days missed by overweight ad ormal weight childre (µ overweight µ ormal ) to be 1.3 days to 2.8 days. Accordig to this iterval, we are 95% cofidet that overweight childre o average miss 1. 1.3 days fewer to 2.8 days more 2. 1.3 to 2.8 days more 3. 1.3 to 2.8 days fewer 4. 1.3 days more to 2.8 days fewer tha childre with ormal weight. 6 7
Uit 4.2 - Bootstrappig Bootstrap iterval, stadard error Bootstrappig works as follows: (1) take a bootstrap sample - a radom sample take with replacemet from the origial sample, of the same size as the origial sample (2) calculate the bootstrap statistic - a statistic such as mea, media, proportio, etc. computed o the bootstrap samples (3) repeat steps (1) ad (2) may times to create a bootstrap distributio - a distributio of bootstrap statistics The XX% bootstrap cofidece iterval ca be estimated by the cutoff values for the middle XX% of the bootstrap distributio, OR poit estimate ± t SE boot For a radom sample of 20 Horror movies, the dot plot below shows the distributio of 100 bootstrap medias of the Rotte Tomatoes audiece scores. The media of the origial sample is 43.5 ad the bootstrap stadard error is 4.88. Estimate the 90% bootstrap cofidece iterval for the media RT score of horror movies usig the stadard error method. 30 35 40 45 50 55 bootstrap medias 8 9 Uit 4.3: Power Uit 4.4: Aalysis of VAriace (ANOVA) Decisio fail to reject H 0 reject H 0 H 0 true 1 α Type 1 Error, α Truth HA true Type 2 Error, β Power, 1 β Type 1 error is rejectig H 0 whe you should t have, ad the probability of doig so is α (sigificace level) Type 2 error is failig to reject H 0 whe you should have, ad the probability of doig so is β (a little more complicated to calculate) Power of a test is the probability of correctly rejectig H 0, ad the probability of doig so is 1 β I hypothesis testig, we wat to keep α ad β low, but there are iheret trade-offs. ANOVA tests for some differece i meas of may differet groups Coditios 1. Idepedece: (a) withi group: sampled observatios must be idepedet (b) betwee group: groups must be idepedet of each other 2. Approximate ormality: distributio should be early ormal withi each group 3. Equal variace: groups should have roughly equal variability (Youwill otbeaskedtocheckthisfromthedata) 10 11
ANOVA tests for some differece i meas of may differet groups Null hypothesis: H 0 : µ placebo = µ purple = µ brow =... = µ peach = µ orage. Clicker questio Which of the followig is a correct statemet of the alterative hypothesis? (a) For ay two groups, icludig the placebo group, o two group meas are the same. (b) For ay two groups, ot icludig the placebo group, o two group meas are the same. (c) Amogst the jelly bea groups, there are at least two groups that have differet group meas from each other. (d) Amogst all groups, there are at least two groups that have differet group meas from each other. F-statistic: F = k: # of groups; : # of obs. SSG / (k 1) SSE / ( k) = MSG MSE Df Sum Sq Mea Sq F value Pr(>F) Betwee groups k 1 SSG MSG F obs p obs Withi groups k SSE MSE Total 1 SSG+SSE Note: F distributio is defied by two dfs: df G = k 1 ad df E = k Thep-valuewillbegiveoexam, comparewiththestadard α level. 12 13 To idetify which meas are differet, use t-tests ad the Boferroi correctio To idetify which meas are differet, use t-tests ad the Boferroi correctio If the ANOVA yields a sigificat results, ext atural questio is: Which meas are differet? Use t-tests comparig each pair of meas to each other, with a commo variace (MSE from the ANOVA table) istead of each group s variaces i the calculatio of the stadard error, ad with a commo degrees of freedom (df E from the ANOVA table) Compare resultig p-values to a modified sigificace level Youwillotbeaskedtoperformtheactualtests, butyou shouldkow: How to compute the adjusted Boferoi sigificace level α. How to compute the stadard error for this test. The associated degrees of freedom for the test statistic. α = α K where K = k(k 1) 2 is the total umber of pairwise tests 14 15
Uit 4.4: ANOVA Uit 4.4: ANOVA ApplicatioExercise4.4 Df Sum Sq Mea Sq F p- value Rak 2 1.59 0.795 2.74 0.066 Residuals 460 135.07 0.29 Total 462 136.66 Whatpercetofthetotalvariabilityievaluatioscoresis explaiedbyistructorrak? ApplicatioExercise4.4 Df Sum Sq Mea Sq F p- value Rak 2 1.59 0.795 2.74 0.066 Residuals 460 135.07 0.29 Total 462 136.66 Whatsigificacelevelshouldbeusedforapair-wisepost hoctestcomparigtheevaluatioscoresofteachig professorsadteuredprofessors? 16 17 Uit 5.1: Iferece for a Sigle Proportio Uit 5.1: Iferece for a Sigle Proportio Distributioof ˆp Cetral limit theorem for proportios: Sample proportios will be early ormally distributed with mea equal to the populatio mea, p (1 p) p, ad stadard error equal to. ( ) p (1 p) ˆp N mea = p, SE = Coditios: Idepedece: Radom sample/assigmet + 10% rule At least 10 successes ad failures HT vs. CI foraproportio Success-failure coditio: CI: At least 10 observed successes ad failures HT: At least 10 expected successes ad failures, calculated usig the ull value Stadard error: CI: calculate usig observed sample proportio: SE = HT: calculate usig the ull value: SE = p 0 (1 p 0 ) ˆp(1 ˆp) 18 19
Recap o simulatio methods Radomizatio Test If the S-F coditio is ot met HT: Radomizatio test simulate uder the assumptio that H 0 is true, the fid the p-value as proportio of simulatios where the simulated ˆp is at least as extreme as the oe observed. CI: Bootstrap iterval resample with replacemet from the origial sample, ad costruct iterval usig percetile or stadard error method. Clicker questio A report o your local TV statio says that 60% of the city s residets support usig limited city fuds to hire ad trai more police officers. A secod local ews statio has picked up this story, ad they claim that certaily less tha 60% of residets support the additioal hirig ad traiig. I order to test this claim the secod ews statio takes a radom sample of 100 residets ad fids that 57 of them (57%) support the use of limited fuds to hire additioal police officers. 20 21 Uit 5.2: Iferece for Two Proportios Clicker questio Which of the followig is the correct set-up for calculatig the p-value for this test? (a) Roll a 10-sided die (outcomes 1-10) 100 times ad record the proportio of times you get a 6 or lower. Repeat this may times, ad calculate the proportio of simulatios where the sample proportio is 57% or less. (b) Roll a 10-sided die (outcomes 1-10) 100 times ad record the proportio of times you get a 6 or lower. Repeat this may times, ad calculate the proportio of simulatios where the sample proportio is 60% or less. (c) I a bag place 100 chips, 57 red ad 43 blue. Radomly sample 100 chips, with replacemet, ad record the proportio of red chips i the sample. Repeat this may times, ad calculate the proportio of samples where 57% or more of the chips are red. (d) Radomly sample 100 residets of a earby city, record how may of the them who support the hirig ad traiig of additioal police officers. Repeat this may times ad calculate the proportio of samples where at least 57% of the residets support additioal hirig ad traiig. CLT alsodescribesthedistributioof ˆp 1 ˆp 2 (ˆp 1 ˆp 2 ) N mea = (p 1 p 2 ), SE = Coditios: + p 2(1 p 2 ) 1 p 1 (1 p 1 ) Idepedece: Radom sample/assigmet + 10% rule Sample size / skew: At least 10 successes ad failures 2 22 23
Uit 5.2: Iferece for Two Proportios Summary ForHT where H 0 : p 1 = p 2, pool! As with workig with a sigle proportio, Whe doig a HT where H 0 : p 1 = p 2 (almost always for HT), use expected couts / proportios for S-F coditio ad calculatio of the stadard error. Otherwise use observed couts / proportios for S-F coditio ad calculatio of the stadard error. Expected proportio of success for both groups whe H 0 : p 1 = p 2 is defied as the pooled proportio: ˆp pool = total successes total sample size = suc 1 + suc 2 1 + 2 Type Parameter Estimator SE SampligDist. Oe mea µ x s/ t 1 Two meas µ diff x diff s d / t 1 Paired data Two meas t df s µ 1 µ 2 x 1 x 2 1 2 + s2 2 1 2 for df use Idepedet mi{ 1 1, 2 1} ˆp(1 ˆp) C.I. Oe prop p ˆp Z p0 (1 p H.T. 0 ) ˆp1 (1 ˆp C.I. 1 ) + ˆp 2 (1 ˆp 2 ) 1 2 Two prop p 1 p 2 ˆp 1 ˆp 2 Z ˆppool (1 ˆp H.T. pool ) + ˆp pool (1 ˆp pool ) 1 2 24 25 Uit 5.3: χ 2 Tests The χ 2 statistic Categoricaldatawithmoretha2levels χ 2 oe variable: χ 2 test of goodess of fit, o CI two variables: χ 2 test of idepedece, o CI Coditiosfor χ 2 testig 1. Idepedece: I additio to what we previously discussed for idepedece, each case that cotributes a cout to the table must be idepedet of all the other cases i the table. 2. Sample size / distributio: Each cell must have at least 5 expected cases. χ 2 statistic: Whe dealig with couts ad ivestigatig how far the observed couts are from the expected couts, we use a ew test statistic called the chi-square (χ 2 ) statistic: χ 2 = k (O E) 2 i=1 Importatpoits: E where k = total umber of cells Use couts (ot proportios) i the calculatio of the text statistic, eve though we re truly iterested i the proportios for iferece Expected couts are calculated assumig the ull hypothesis is true 26 27
The χ 2 distributio The χ 2 distributio has just oe parameter, degrees of freedom (df), which iflueces the shape, ceter, ad spread of the distributio. For χ 2 GOF test: df = k 1 For χ 2 idepedece test: df = (R 1) (C 1) Degrees of Freedom 2 4 9 0 5 10 15 20 25 28