+ Reply to Thread
Results 1 to 8 of 8

Thread: (3x4) 2way anova

  1. #1
    Points: 1,620, Level: 23
    Level completed: 20%, Points required for next Level: 80

    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    (3x4) 2way anova




    Hi there. I have a problem with conducting the 3x4 anova test. I have two independent variables - data through 3 years divided into 4 seasons (spring, winter...). The dependent variable is the frequency of patients.

    No matter in what statistical software I try to do the test, I always get the same - a nice plot with interactions, but no F test and p value. Can someone try to give an advice on what I am doing wrong?

    In the attachment you can find the dataset and a plot which shows the problems I am facing.

    Thank you in advance!
    Attached Files

  2. #2
    TS Contributor
    Points: 14,811, Level: 78
    Level completed: 91%, Points required for next Level: 39
    Miner's Avatar
    Location
    Greater Milwaukee area
    Posts
    1,171
    Thanks
    34
    Thanked 405 Times in 363 Posts

    Re: (3x4) 2way anova

    If you included an interaction term, you have a fully saturated model with zero degrees of freedom for the error term, which is used to calculate the F-statistic, which is used to determine the p-value. Since you probably cannot replicate this data, your only option is to remove the interaction term from the model. This will free a degree of freedom for the error term.

  3. The Following User Says Thank You to Miner For This Useful Post:

    ivn (04-04-2014)

  4. #3
    Points: 1,620, Level: 23
    Level completed: 20%, Points required for next Level: 80

    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: (3x4) 2way anova

    thanks, but... how can i do that?

  5. #4
    Points: 1,620, Level: 23
    Level completed: 20%, Points required for next Level: 80

    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: (3x4) 2way anova

    although i am new to R, i tried to do this, and i managed to get some results, but i am not sure if this is correct.

    Response: kalk$count
    Df Sum Sq Mean Sq F value Pr(>F)
    kalk$year 1 32.00 32.00 0.3039 0.5965
    kalk$season 1 299.27 299.27 2.8424 0.1303
    kalk$year:kalk$season 1 152.10 152.10 1.4446 0.2638
    Residuals 8 842.30 105.29

  6. #5
    Devorador de queso
    Points: 95,540, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: (3x4) 2way anova

    Quote Originally Posted by ivn View Post
    although i am new to R, i tried to do this, and i managed to get some results, but i am not sure if this is correct.

    Response: kalk$count
    Df Sum Sq Mean Sq F value Pr(>F)
    kalk$year 1 32.00 32.00 0.3039 0.5965
    kalk$season 1 299.27 299.27 2.8424 0.1303
    kalk$year:kalk$season 1 152.10 152.10 1.4446 0.2638
    Residuals 8 842.30 105.29
    Looks like you were treating year and season as continuous in this output. That is probably not what you want to do. You want year and season to be in R as 'factors'.
    I don't have emotions and sometimes that makes me very sad.

  7. #6
    Points: 1,620, Level: 23
    Level completed: 20%, Points required for next Level: 80

    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: (3x4) 2way anova

    Thank you Dason, you're right.

    I did it another time, but i'd like someone to comment on this. I wrote the test using the coding example from the website below:

    https://personality-project.org/r/r.anova.html

    > aov.ex2 = aov(klak$N.cases.~klak$season*klak$year)
    > summary(aov.ex2)
    Df Sum Sq Mean Sq F value Pr(>F)
    klak$season 3 877.7 292.56 7.179 0.0435 *
    klak$year 1 32.0 32.00 0.785 0.4256
    klak$season:klak$year 3 253.0 84.33 2.070 0.2470
    Residuals 4 163.0 40.75

    I am a bit confused with it. Can someone write the correct R code?
    Those results seem to be intuitively correct, because if I run a one way ANOVA for the klak$season, i get an p=0.0274 * and for klak$year an p=0.63.

    Is it appropriate to substitute the 2way anova for the 2 separate one way ANOVA if I cannont calculate the p value, because of the degrees of freedom?

  8. #7
    TS Contributor
    Points: 12,227, Level: 72
    Level completed: 45%, Points required for next Level: 223
    rogojel's Avatar
    Location
    I work in Europe, live in Hungary
    Posts
    1,470
    Thanks
    160
    Thanked 332 Times in 312 Posts

    Re: (3x4) 2way anova

    Hi,
    if you use + instead of the * in the function call, you get a model without the interaction term. Other then that your output seems completely ok to me, what is the problem with it?

    regards
    rogojel

  9. #8
    Points: 1,620, Level: 23
    Level completed: 20%, Points required for next Level: 80

    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: (3x4) 2way anova


    The problem appears when using the same dataset in statistica and spss, because i don't get the p values and f test, mainly because of the reasons Miner said. That's why I'm not sure if the R results are correct

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats