Hadout #5 Ttle: FAE Course: Eco 368/01 Spr/015 Istructor: Dr. I-M Chu Itroducto to the Des of Expermets (DOX) (Read: FCDAE, Chapter 1~3) I hadout oe, we leared that data ca be ether observatoal or expermetal. Us observatoal data, we ca detect assocatos betwee varables; however, t s dffcult to buld causal relatoshps. Oe of the advataes of us the expermetal data s t s collected a cotrolled evromet, ad therefore, a causal relatoshp ca be establshed betwee causes ad effects. Des of expermets helps us establsh causalty betwee respose () ad treatmets (Xs) ve that the cofoud effects ca be reduced to the mmum. Whle we wll use the examples ad the correspod data from the FCDAE ad BR books mostly, I wll provde a smulated data set to exame the effectveess of three lear evromets prcples of ecoomcs classes; amely, o-ste, o-le, ad hybrd. Compoets of a expermet: a) Treatmets. b) Expermet uts. c) Respose. d) Assmet method. e.. Does short-term carcerato of spouse abusers deter future assaults? Treatmets: war, cousel but ot booked o chares, ad arrest. Expermet uts: dvduals who assault ther spouses. Respose: the leth of tme utl recurrece of assault. Assmet method: radomzato. Notce: DOX s ot about the statstcal aalyss; t s about how we collect data for further aalyss. Radomzato: a expermet s radomzed f the method for ass treatmets to uts volves a kow, well-uderstood probablstc scheme. The probablstc scheme s called a radomzato. Radomzato reduces cofoud. What s cofoud? e.. Weather Drv Speed Accdets 1
e.. ew dru treatmet vs. bypass surery for coroary artery dsease. e.. productve of two varety of cor; oe s plated Wscos ad the other s plated Iowa. Completely Radomzed Dess (CRD) Structure of a CRD We have treatmets to compare ad N uts to use our expermet. For a completely radomzed des: 1. Select sample szes 1,,..., wth 1 + +... + N.. Choose 1 uts at radom to receve treatmet 1, uts at radom from the N 1 rema to receve treatmet, ad so o. Ths radomzato produces a CRD; all possble arraemets of the N uts to roups wth szes 1 thouh are equally lkely. Note that complete radomzato oly addresses the assmet of treatmets to uts; selecto of treatmets, expermetal uts, ad resposes s also requred. Model: A model for the data s a specfcato of the statstcal dstrbuto for the data (sampl scheme). Parameter: Statstcal dstrbuto depeds o parameters. e.. Bomal (, ), Normal (, ) Expermetal data: a) Model for the mea b) Model for the error Model 1: Separate meas model, j +, j + +, j (equvaletly;, j N(, )) Model : Sle mea model, j +, j (equvaletly;, j N(, )) Sle mea model s a reduced model; t s a specal case of the roup meas model. Estmates of parameters both models
Notatos:, j (roup total) 1, j 1 (rad total) /, / (treatmet mea) j /N (rad mea) - - (treatmet effects), j - +, j Aalyss of Varace (Oe way ANOVA): ANOVA ca be cosdered as a exteso of two-sample t-test; I wll revew t our ed of lecture exercses. Please refer to the BR book, pp. 193~03, for a varety of two-sample t-tests., j - ( - ) + (, j - ) (, j ) 1 1 ( ) + (, j 1 ) SS T SS Trt + SS E Where SS Trt 1 ( ) ( ) 1 1 ANOVA Table Source DF SS MS F Treatmets - 1 SS Trt SS Trt /-1 MS Trt / MS E Error N - SS E SS E /N- 3
H 0 : there s o treatmet effect H A : otherwse Decso rule: Reject ull f F s lare. Exercse 3. (FCDAE, pp. 60) A expermeter radomly allocated 15 male turkeys to fve treatmet roups: cotrol ad treatmets A, B, C, ad D. There were 5 brds each roup, ad the mea results were.16,.45,.91, 3.00, ad.71, respectvely. The sum of squares for expermetal error was 153.4. Test the ull hypothess that the fve roup meas are the same aast the alteratve that oe or more of the treatmets dffers from the cotrol. Oe-Way ANOVA SS T SS Trt + SS E Based o the formato ve the questo, we ca calculate both SS Trt ad SS E ad the coduct a F test. (Why do we use F test?) Correcto: - ; are ve the questo ad (.16+.45+.91+3+.71)/5.646 SS Trt - 5 1 SS E 153.4 SS Trt 11.843 0.486, 0.196, 0.64, 0.354, ad 0.064 5*(-0.486 + -0.196 + 0.64 + 0.354 + 0.064 ) 11.843 F Obs MS MS Trt E SS SS E / 4 / 10 Trt 11. 843 / 4 153. 4 / 10.316 Sce F Obs < F 0.95,4,10 (.447) or the p-value 0.061, therefore, we caot reject the ull hypothess that roup meas are the same. ANOVA Table Source DF SS MS F Treatmets 4 11.843.96075.316 Error 10 153.4 1.7833 Total 14 165.43 4
Use R for ONE-WA ANOVA The purpose s to test whether the meas of multple samples (>) are the same., j + +, j Where dcates levels (factors) ad j dcates observatos. Later you wll fd that the above equato s smlar to lear reresso model, the dfferece s the type of explaatory varable (quattatve or qualtatve). If there are both types of explaatory varables, the model s termed ANCOVA some felds. Ecoomsts do t use ths term. We wat to test H 0 :, j +, j H 1 :, j + +, j We ll do may R exercses the class meet. I wo t prepare the R code fle for ths lecture ad the oal s to see whether you re famlar wth some basc R usaes. e.. det ad blood coaulato > lbrary("faraway") > data(coaulato) > ames(coaulato) > attach(coaulato) > plot(coa~det) > Model1 lm(coa~det,coaulato) > summary(model1) Call: lm(formula coa ~ det, data coaulato) Resduals: M 1Q Meda 3Q Max -5.00-1.5 0.00 1.5 5.00 Coeffcets: Estmate Std. Error t value Pr(> t ) (Itercept) 6.100e+01 1.183e+00 51.554 < e-16 *** detb 5.000e+00 1.58e+00 3.73 0.003803 ** detc 7.000e+00 1.58e+00 4.583 0.000181 *** detd -3.333e-15 1.449e+00 0.000 1.000000 --- Sf. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 Resdual stadard error:.366 o 0 derees of freedom 5
Multple R-squared: 0.6706, Adjusted R-squared: 0.61 F-statstc: 13.57 o 3 ad 0 DF, p-value: 4.658e-05 > Model1ull lm(coa~1,coaulato) > aova(model1ull,model1) Aalyss of Varace Table Model 1: coa ~ 1 Model : coa ~ det Res.Df RSS Df Sum of Sq F Pr(>F) 1 3 340 0 11 3 8 13.571 4.658e-05 *** --- Sf. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 Exercses: (a) Please use the BodyTemperature.txt data fle to aalyze whether Geder s a cotrbut factor to the Temperature (revew two-sample t-test) (b) Please use ecolear.csv data fle to exame whether lear evromets cotrbute to dfferet lear outcomes. *For those who are terested two-way ANOVA or -way ANOVA, please read FCDAE or BR to lear how to deal wth two (or ) treatmets. 6