STA
discussion8.pdf

# 11 i1 j1 2 17 i2 j1 3 15 i1 j2 4 19 i2 j2 5 16 i1 j3

• 4

This preview shows pages 2–4. Sign up to view the full content.

11 i=1 j=1 ## 2 17 i=2 j=1 ## 3 15 i=1 j=2 ## 4 19 i=2 j=2 ## 5 16 i=1 j=3 ## 6 20 i=2 j=3 library (ggplot2) ggplot ( data = data2, aes ( x = B, y = response, group = A, colour = A)) + geom_line ( size = 2 ) + theme_bw () 12.5 15.0 17.5 20.0 j=1 j=2 j=3 B response A i=1 i=2 ii. ANOVA table a = 2 ; b = 3 Y_bar = mean (data2 \$ response) mu_i = tapply (data2 \$ response, data2 \$ A, mean) mu_i ## i=1 i=2 ## 14.00000 18.66667 2

This preview has intentionally blurred sections. Sign up to view the full version.

mu_j = tapply (data2 \$ response,data2 \$ B, mean) mu_j ## j=1 j=2 j=3 ## 14 17 18 SSA = b * sum ((mu_i - Y_bar) ^ 2 ) SSB = a * sum ((mu_j - Y_bar) ^ 2 ) SSTO = sum ((data2 \$ response - Y_bar) ^ 2 ) SSAB = SSTO - SSA - SSB df_SSA = a - 1 ; df_SSB = b - 1 ; df_SSAB = (a - 1 ) * (b - 1 ); df_SSTO = a * b - 1 MSA = SSA / df_SSA; MSB = SSB / df_SSB; MSAB = SSAB / df_SSAB library (knitr) anova.table <- matrix ( c (SSA,SSB,SSAB,SSTO, df_SSA,df_SSB,df_SSAB,df_SSTO, MSA,MSB,MSAB, NA ), 4 , 3 ) rownames (anova.table) <- c ( "Factor A" , "Factor B" , "Error" , "Total" ) colnames (anova.table) <- c ( "SS" , "df" , "MS" ) kable (anova.table, digits = 4 ) SS df MS Factor A 32.6667 1 32.6667 Factor B 17.3333 2 8.6667 Error 1.3333 2 0.6667 Total 51.3333 5 NA Conduct test for factor A main effect at level of significance α = 0 . 05 . F_star = MSA / MSAB alpha = 0.05 cv = qf ( 1 - alpha, df_SSA, df_SSAB) cv ## [1] 18.51282 F_star ## [1] 49 F_star > cv ## [1] TRUE p_value = 1 - pf (F_star, df_SSA, df_SSAB) p_value ## [1] 0.01980394 iii. 95% confidence interval for D 1 = μ . 2 - μ . 1 , D 2 = μ . 3 - μ . 2 . Dhat1 = mu_j[ 2 ] - mu_j[ 1 ]; Dhat2 = mu_j[ 3 ] - mu_j[ 2 ] sDhat = sqrt ( 2 * MSAB / a) g = 2 3
B = qt ( 1 - alpha / ( 2 * g), df_SSAB) B ## [1] 6.205347 c (Dhat1 - B * sDhat,Dhat1 + B * sDhat ) ## j=2 j=2 ## -2.066644 8.066644 S = sqrt ((b - 1 ) * qf ( 1 - alpha, b - 1 , df_SSAB)) S ## [1] 6.164414 c (Dhat1 - S * sDhat,Dhat1 + S * sDhat ) ## j=2 j=2 ## -2.033223 8.033223 Tukey = qtukey ( 1 - alpha, b, df_SSAB) / sqrt ( 2 ) c (Dhat1 - Tukey * sDhat,Dhat1 + Tukey * sDhat ) ## j=2 j=2 ## -1.80978 7.80978 4
This is the end of the preview. Sign up to access the rest of the document.
• Spring '13
• Normal Distribution, Factor D, SSAB, Alternative complement pathway, Complement factor B

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern