SlideShare a Scribd company logo
1 of 3
Download to read offline
Example of Doing Two way ANOVA


1    Two Way Analysis of Variance by Hand
Error Decomposition

           a     b   r                  2                     a                      2               3                           2
                         Yijk − Y¯
                                 ···         = r·b·                    Y¯ − Y¯
                                                                        i··  ···         +r · a ·          Y¯ − Y¯
                                                                                                            ·j·  ···
          i=1 j=1 k=1                                        i=1                                    j=1

                     SST otal                                         SSA                                 SSB
                                                               a       b                                        2        a       b   r                 2
                                                 +r ×                       Y¯ − Y¯ − Y¯ + Y¯
                                                                             ij·  i··  ·j·  ···                     +                    Yijk − Y¯
                                                                                                                                                 ij·
                                                              i=1 j=1                                                   i=1 j=1 k=1

                                                                                 SSA×B                                               SSwithin

ANOVA Table


                         Source       Degrees of Freedom                    SS               MS                              F
                           A                   a-1                          SSA            M SA             M SA M Swithin
                           B                   b-1                          SSB            M SB             M SB M Swithin
                         A×B                (a-1)(b-1)                  SSA×B            M SA×B            M SA×B M Swithin
                         Within               ab(r-1)                   SSwithin         M Swithin
                         Total                 abr-1                    SST otal

Example Suppose you want to determine whether the brand of laundry detergent used and the temperature affects the amount
of dirt removed from your laundry. To this end, you buy two different brand of detergent (“ Super” and “Best”) and choose
three different temperature levels (“cold”, “warm”, and “hot”). Then you divide your laundry randomly into 6 × r piles of equal
size and assign each r piles into the combination of (“Super” and “Best”) and (”cold”,”warm”, and “hot”). In this example, we
are interested in testing Null Hypotheses

                         H0D      :   The amount of dirt removed does not depend on the type of detergent
                         H0T      :   The amount of dirt removed does not depend on the temperature

One says the experiment has two factors (Factor Detergent, Factor Temperature) at a = 2(Super and Best) and b = 3(cold,warm
and hot) levels. Thus there are ab = 3 × 2 = 6 different combinations of detergent and temperature. With each combination
you wash r = 4 loads. r is called the number of replicates. This sums up to n = abr = 24 loads in total. The amounts Yijk of
dirt removed when washing sub pile k (k = 1, 2, 3, 4) with detergent i (i = 1, 2) at temperature j (j = 1, 2, 3) are recorded in
Table 1.

                                                              Cold             Warm                Hot
                                             Super           4,5,6,5         7,9,8,12           10,12,11,9
                                             Best            6,6,4,4        13,15,12,12        12,13,10,13

    Solution :

                                                Cold                    Warm                       Hot                       mD
                                  Super      4,5,6,5 (5)             7,9,8,12 (9)             10,12,11,9 (10)                 8
                                  Best       6,6,4,4 (5)           13,15,12,12 (13)          12,13,10,13 (12)                10
                                   mT             5                       11                        11                        9


    • SSwithin and dfwithin
                                                         2        3     4                     2
                                  SSwithin      =                            Yijk − Y¯
                                                                                     ij·
                                                     i=1 j=1 k=1


                                                                                 1
= (4 − 5)2 + (5 − 5)2 + (6 − 5)2 + (5 − 5)2
                                                +(7 − 9)2 + (9 − 9)2 + (8 − 9)2 + (12 − 9)2
                                                ······
                                                +(12 − 12)2 + (13 − 12)2 + (10 − 12)2 + (13 − 12)2
                                              = 38
                             dfwithin         = (r − 1) ∗ a ∗ b = 3 ∗ 2 ∗ 3 = 18
                           M Swithin          = SSwithin dfwithin = 38/18 = 2.1111

  • SSdetergent and dfdetergent
                                                                    2                    2
                                      SSdetergent       = r·b·               Y¯ − Y¯
                                                                              i··  ···
                                                                   i=1

                                                        =   4 × 3 × (8 − 9)2 + (10 − 9)2 = 24
                                          dfdetergent   = a−1=1
                                    M Sdetergent        = SSdetergent dfdetergent = 24 1 = 24

  • SStemperature and dftemperature
                                                              3                    2
                            SStemperature          = r·a·           Y¯ − Y¯
                                                                     ·j·  ···
                                                             j=1

                                                   =    4 × 2 × (5 − 9)2 + (11 − 9)2 + (11 − 9)2 = 24
                             dftemparature         = b−1=2
                           M Stemperature          = SStemperature dftemperature = 192 2 = 81

  • SSinteraction and dfinteraction
                               2      3                                  2
     SSinteraction    = r×                   Y¯ − Y¯ − Y¯ + Y¯
                                              ij·  i··  ·j·  ···
                              i=1 j=1

                      = 4 × (5 − 8 − 5 + 9)2 + (9 − 8 − 11 + 9)2 + (110 − 8 − 11 + 9)2 + · · · + (12 − 11 − 10 + 9)2 = 12
      dfinteraction   = (a − 1) × (b − 1) = 2 × 1 = 2
    M Sinteraction    = SSinteraction dfinteraction = 12 2 = 6

  • F-Test

                                      M Sdetergent M Swithin            ∼ F dfdetergent , dfwithin

                                   M Stemperature M Swithin             ∼ F dftemperature , dfwithin

                                   M Sinteraction M Swithin             ∼ F dfinteraction , dfwithin

Two Way ANOVA in R
> wash=scan()
1: 4 5 6 5 7 9 8 12 10 12 11 9
13: 6 6 4 4 13 15 12 12             > water
21: 12 13 10 13                      [1] 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3
25:                                 Levels: 1 2 3
Read 24 items                       > deter
> mean(wash)                         [1] 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2
[1] 9.083333                        Levels: 1 2
> deter=factor(c(rep(1,12),rep(2,12)))
> water=factor(rep(gl(3,4),2))

                                                                   2
> tapply(wash,water,mean)
    1     2     3
 5.00 11.00 11.25
> tapply(wash,deter,mean)
        1         2
 8.166667 10.000000
> tapply(wash,deter:water,mean)
 1:1 1:2 1:3 2:1 2:2 2:3
 5.0 9.0 10.5 5.0 13.0 12.0
> anova(lm.deter)
Analysis of Variance Table

Response: wash
            Df Sum Sq Mean Sq F value    Pr(>F)
deter        1 20.167 20.167 9.8108 0.005758 **
water        2 200.333 100.167 48.7297 5.44e-08 ***
deter:water 2 16.333     8.167 3.9730 0.037224 *
Residuals   18 37.000    2.056
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> matrix(round(fitted(lm.deter),1),byrow=T,nrow=2)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]    5    5    5    5    9    9    9    9 10.5 10.5 10.5 10.5
[2,]    5    5    5    5   13   13   13   13 12.0 12.0 12.0 12.0
> matrix(round(residuals(lm.deter),1),byrow=T,nrow=2)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]   -1    0    1    0   -2    0   -1    3 -0.5   1.5   0.5 -1.5
[2,]    1    1   -1   -1    0    2   -1   -1 0.0    1.0 -2.0    1.0
> matrix(round(residuals(lm.deter),1)ˆ2,byrow=T,nrow=2)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]    1    0    1    0    4    0    1    9 0.25 2.25 0.25 2.25
[2,]    1    1    1    1    0    4    1    1 0.00 1.00 4.00 1.00
interaction.plot(water,deter,wash)




                                        deter
               12




                                                2
                                                1
               10
mean of wash

               8
               6




                    1   2           3


                            water




                                        3

More Related Content

Viewers also liked

How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingContent Marketing Institute
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...SlideShare
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

Viewers also liked (6)

How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similar to Two way example

Integrated exercise a_(book_2_B)_Ans
Integrated exercise a_(book_2_B)_AnsIntegrated exercise a_(book_2_B)_Ans
Integrated exercise a_(book_2_B)_Ansken1470
 
Inversematrixpptx 110418192746-phpapp014.7
Inversematrixpptx 110418192746-phpapp014.7Inversematrixpptx 110418192746-phpapp014.7
Inversematrixpptx 110418192746-phpapp014.7Kimguan Tan
 
Inverse matrix pptx
Inverse matrix pptxInverse matrix pptx
Inverse matrix pptxKimguan Tan
 
Lesson32 Second Order Difference Equations Slides
Lesson32   Second Order Difference Equations SlidesLesson32   Second Order Difference Equations Slides
Lesson32 Second Order Difference Equations SlidesMatthew Leingang
 
Trial Sbp 2007 Answer Mm 1 & 2
Trial Sbp 2007 Answer Mm 1 & 2Trial Sbp 2007 Answer Mm 1 & 2
Trial Sbp 2007 Answer Mm 1 & 2norainisaser
 
Unit 3 hw 4 - solving equations variable both sides
Unit 3   hw 4 - solving equations variable both sidesUnit 3   hw 4 - solving equations variable both sides
Unit 3 hw 4 - solving equations variable both sidesLori Rapp
 
AA Section 5-3
AA Section 5-3AA Section 5-3
AA Section 5-3Jimbo Lamb
 
5 maths cbse_2012-13_12th_20-03-13
5 maths cbse_2012-13_12th_20-03-135 maths cbse_2012-13_12th_20-03-13
5 maths cbse_2012-13_12th_20-03-13studymate
 
Presentation5 1
Presentation5 1Presentation5 1
Presentation5 1mrich1911
 
Worksheets on graphs of trigonometry 2010
Worksheets on graphs of trigonometry 2010Worksheets on graphs of trigonometry 2010
Worksheets on graphs of trigonometry 2010bryan
 
09 Trial Penang S1
09 Trial Penang S109 Trial Penang S1
09 Trial Penang S1guest9442c5
 

Similar to Two way example (20)

Section 07 manova
Section 07 manovaSection 07 manova
Section 07 manova
 
Integrated exercise a_(book_2_B)_Ans
Integrated exercise a_(book_2_B)_AnsIntegrated exercise a_(book_2_B)_Ans
Integrated exercise a_(book_2_B)_Ans
 
Anov af03
Anov af03Anov af03
Anov af03
 
Inversematrixpptx 110418192746-phpapp014.7
Inversematrixpptx 110418192746-phpapp014.7Inversematrixpptx 110418192746-phpapp014.7
Inversematrixpptx 110418192746-phpapp014.7
 
Inverse matrix pptx
Inverse matrix pptxInverse matrix pptx
Inverse matrix pptx
 
Lesson32 Second Order Difference Equations Slides
Lesson32   Second Order Difference Equations SlidesLesson32   Second Order Difference Equations Slides
Lesson32 Second Order Difference Equations Slides
 
Trial Sbp 2007 Answer Mm 1 & 2
Trial Sbp 2007 Answer Mm 1 & 2Trial Sbp 2007 Answer Mm 1 & 2
Trial Sbp 2007 Answer Mm 1 & 2
 
Math11
Math11Math11
Math11
 
Unit 3 hw 4 - solving equations variable both sides
Unit 3   hw 4 - solving equations variable both sidesUnit 3   hw 4 - solving equations variable both sides
Unit 3 hw 4 - solving equations variable both sides
 
Pattern6 4
Pattern6 4Pattern6 4
Pattern6 4
 
AA Section 5-3
AA Section 5-3AA Section 5-3
AA Section 5-3
 
5 maths cbse_2012-13_12th_20-03-13
5 maths cbse_2012-13_12th_20-03-135 maths cbse_2012-13_12th_20-03-13
5 maths cbse_2012-13_12th_20-03-13
 
Presentation5 1
Presentation5 1Presentation5 1
Presentation5 1
 
Worksheets on graphs of trigonometry 2010
Worksheets on graphs of trigonometry 2010Worksheets on graphs of trigonometry 2010
Worksheets on graphs of trigonometry 2010
 
S 5
S 5S 5
S 5
 
Week 11 - Trigonometry
Week 11 - TrigonometryWeek 11 - Trigonometry
Week 11 - Trigonometry
 
Em02 im
Em02 imEm02 im
Em02 im
 
Gr aph of cosine
Gr aph of cosineGr aph of cosine
Gr aph of cosine
 
09 Trial Penang S1
09 Trial Penang S109 Trial Penang S1
09 Trial Penang S1
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 

Recently uploaded

The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...Aggregage
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1kcpayne
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...lizamodels9
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...lizamodels9
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...amitlee9823
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noidadlhescort
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with CultureSeta Wicaksana
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLSeo
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756dollysharma2066
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Sheetaleventcompany
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Centuryrwgiffor
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperityhemanthkumar470700
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfAdmir Softic
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 

Recently uploaded (20)

The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 

Two way example

  • 1. Example of Doing Two way ANOVA 1 Two Way Analysis of Variance by Hand Error Decomposition a b r 2 a 2 3 2 Yijk − Y¯ ··· = r·b· Y¯ − Y¯ i·· ··· +r · a · Y¯ − Y¯ ·j· ··· i=1 j=1 k=1 i=1 j=1 SST otal SSA SSB a b 2 a b r 2 +r × Y¯ − Y¯ − Y¯ + Y¯ ij· i·· ·j· ··· + Yijk − Y¯ ij· i=1 j=1 i=1 j=1 k=1 SSA×B SSwithin ANOVA Table Source Degrees of Freedom SS MS F A a-1 SSA M SA M SA M Swithin B b-1 SSB M SB M SB M Swithin A×B (a-1)(b-1) SSA×B M SA×B M SA×B M Swithin Within ab(r-1) SSwithin M Swithin Total abr-1 SST otal Example Suppose you want to determine whether the brand of laundry detergent used and the temperature affects the amount of dirt removed from your laundry. To this end, you buy two different brand of detergent (“ Super” and “Best”) and choose three different temperature levels (“cold”, “warm”, and “hot”). Then you divide your laundry randomly into 6 × r piles of equal size and assign each r piles into the combination of (“Super” and “Best”) and (”cold”,”warm”, and “hot”). In this example, we are interested in testing Null Hypotheses H0D : The amount of dirt removed does not depend on the type of detergent H0T : The amount of dirt removed does not depend on the temperature One says the experiment has two factors (Factor Detergent, Factor Temperature) at a = 2(Super and Best) and b = 3(cold,warm and hot) levels. Thus there are ab = 3 × 2 = 6 different combinations of detergent and temperature. With each combination you wash r = 4 loads. r is called the number of replicates. This sums up to n = abr = 24 loads in total. The amounts Yijk of dirt removed when washing sub pile k (k = 1, 2, 3, 4) with detergent i (i = 1, 2) at temperature j (j = 1, 2, 3) are recorded in Table 1. Cold Warm Hot Super 4,5,6,5 7,9,8,12 10,12,11,9 Best 6,6,4,4 13,15,12,12 12,13,10,13 Solution : Cold Warm Hot mD Super 4,5,6,5 (5) 7,9,8,12 (9) 10,12,11,9 (10) 8 Best 6,6,4,4 (5) 13,15,12,12 (13) 12,13,10,13 (12) 10 mT 5 11 11 9 • SSwithin and dfwithin 2 3 4 2 SSwithin = Yijk − Y¯ ij· i=1 j=1 k=1 1
  • 2. = (4 − 5)2 + (5 − 5)2 + (6 − 5)2 + (5 − 5)2 +(7 − 9)2 + (9 − 9)2 + (8 − 9)2 + (12 − 9)2 ······ +(12 − 12)2 + (13 − 12)2 + (10 − 12)2 + (13 − 12)2 = 38 dfwithin = (r − 1) ∗ a ∗ b = 3 ∗ 2 ∗ 3 = 18 M Swithin = SSwithin dfwithin = 38/18 = 2.1111 • SSdetergent and dfdetergent 2 2 SSdetergent = r·b· Y¯ − Y¯ i·· ··· i=1 = 4 × 3 × (8 − 9)2 + (10 − 9)2 = 24 dfdetergent = a−1=1 M Sdetergent = SSdetergent dfdetergent = 24 1 = 24 • SStemperature and dftemperature 3 2 SStemperature = r·a· Y¯ − Y¯ ·j· ··· j=1 = 4 × 2 × (5 − 9)2 + (11 − 9)2 + (11 − 9)2 = 24 dftemparature = b−1=2 M Stemperature = SStemperature dftemperature = 192 2 = 81 • SSinteraction and dfinteraction 2 3 2 SSinteraction = r× Y¯ − Y¯ − Y¯ + Y¯ ij· i·· ·j· ··· i=1 j=1 = 4 × (5 − 8 − 5 + 9)2 + (9 − 8 − 11 + 9)2 + (110 − 8 − 11 + 9)2 + · · · + (12 − 11 − 10 + 9)2 = 12 dfinteraction = (a − 1) × (b − 1) = 2 × 1 = 2 M Sinteraction = SSinteraction dfinteraction = 12 2 = 6 • F-Test M Sdetergent M Swithin ∼ F dfdetergent , dfwithin M Stemperature M Swithin ∼ F dftemperature , dfwithin M Sinteraction M Swithin ∼ F dfinteraction , dfwithin Two Way ANOVA in R > wash=scan() 1: 4 5 6 5 7 9 8 12 10 12 11 9 13: 6 6 4 4 13 15 12 12 > water 21: 12 13 10 13 [1] 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 25: Levels: 1 2 3 Read 24 items > deter > mean(wash) [1] 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 [1] 9.083333 Levels: 1 2 > deter=factor(c(rep(1,12),rep(2,12))) > water=factor(rep(gl(3,4),2)) 2
  • 3. > tapply(wash,water,mean) 1 2 3 5.00 11.00 11.25 > tapply(wash,deter,mean) 1 2 8.166667 10.000000 > tapply(wash,deter:water,mean) 1:1 1:2 1:3 2:1 2:2 2:3 5.0 9.0 10.5 5.0 13.0 12.0 > anova(lm.deter) Analysis of Variance Table Response: wash Df Sum Sq Mean Sq F value Pr(>F) deter 1 20.167 20.167 9.8108 0.005758 ** water 2 200.333 100.167 48.7297 5.44e-08 *** deter:water 2 16.333 8.167 3.9730 0.037224 * Residuals 18 37.000 2.056 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > matrix(round(fitted(lm.deter),1),byrow=T,nrow=2) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 5 5 5 5 9 9 9 9 10.5 10.5 10.5 10.5 [2,] 5 5 5 5 13 13 13 13 12.0 12.0 12.0 12.0 > matrix(round(residuals(lm.deter),1),byrow=T,nrow=2) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] -1 0 1 0 -2 0 -1 3 -0.5 1.5 0.5 -1.5 [2,] 1 1 -1 -1 0 2 -1 -1 0.0 1.0 -2.0 1.0 > matrix(round(residuals(lm.deter),1)ˆ2,byrow=T,nrow=2) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 1 0 1 0 4 0 1 9 0.25 2.25 0.25 2.25 [2,] 1 1 1 1 0 4 1 1 0.00 1.00 4.00 1.00 interaction.plot(water,deter,wash) deter 12 2 1 10 mean of wash 8 6 1 2 3 water 3