Hi I have a linear model and I want to tests whether the model terms are significant I used anova but F and P value depend on the order of the terms in the model. I have repeated the same analysis in another stat software and F and P value did not differ with order of terms in the model. Can anyone can explain what happen or what am I doing wrong ? In R> anova (lm(Y~X.1+X.2))Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X.1 1 4.0351 4.0351 6.5187 0.01852 X.2 1 0.5903 0.5903 0.9537 0.33991 Residuals 21 12.9991 0.619> anova (lm(Y~X.2+X.1))Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X.2 1 1.9651 1.9651 3.1747 0.08926 X.1 1 2.6603 2.6603 4.2977 0.05066 Residuals 21 12.9991 0.619 With another stat software (JMP) Y~X.1+X.2 Df Sum Sq Mean Sq F value Pr(>F) X.1 1 2.6603 2.6603 4.2977 0.05066 X.2 1 0.5903 0.5903 0.9537 0.33991 Residuals 21 12.9991 0.619 Y~X.2+X.1 Df Sum Sq Mean Sq F value Pr(>F) X.2 1 0.5903 0.5903 0.9537 0.33991 X.1 1 2.6603 2.6603 4.2977 0.05066 Residuals 21 12.9991 0.619 --------------------------------------------------------------------------- Julien Martin Canadian Research Chair in behavioural ecology Universit?? du Qu??bec ?? Montr??al Email: martin.julien.2 at courrier.uqam.ca
I suggest you consult a local statistician or read up on linear models,perhaps by reading the relevant section of V&R's MASS. Also search the R-Help archives for "Type III SS." Further comments below. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Martin Julien > Sent: Tuesday, January 17, 2006 12:34 PM > To: r-help at stat.math.ethz.ch > Subject: [R] Anova problem with order of terms in model > > Hi > I have a linear model and I want to tests whether the model terms are > significant > I used anova but F and P value depend on the order of the terms in the > model.Correct. Differennt hypotheses are being tested. R does **sequential** SS (this preserves additivity/orthogonality of contrasts being tested). In a non-orthogonal designs, these depend on order.> I have repeated the same analysis in another stat software > and F and P value > did not differ with order of terms in the model. > Can anyone can explain what happen or what am I doing wrong ?And this "other software" is not doing a sequential SS, but rather what is usually called Type III SS (google on "Type III SS" for more info).
Dear Martin, The anova() function computes sequential (sometimes called "type-I") tests; I'm not sure what Jmp does by default, but either "type-II" or "type-III" tests would produce these results for a model of this structure. See the Anova() function in the car package for "type-II" and "III" tests. I hope this helps, John -------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox --------------------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Martin Julien > Sent: Tuesday, January 17, 2006 3:34 PM > To: r-help at stat.math.ethz.ch > Subject: [R] Anova problem with order of terms in model > > Hi > I have a linear model and I want to tests whether the model > terms are significant I used anova but F and P value depend > on the order of the terms in the model. > I have repeated the same analysis in another stat software > and F and P value did not differ with order of terms in the model. > Can anyone can explain what happen or what am I doing wrong ? > > In R > > anova (lm(Y~X.1+X.2)) > Analysis of Variance Table > Response: Y > Df Sum Sq Mean Sq F value Pr(>F) > X.1 1 4.0351 4.0351 6.5187 > 0.01852 > X.2 1 0.5903 0.5903 0.9537 > 0.33991 > Residuals 21 12.9991 0.619 > > > anova (lm(Y~X.2+X.1)) > Analysis of Variance Table > Response: Y > Df Sum Sq Mean Sq F value Pr(>F) > X.2 1 1.9651 1.9651 3.1747 > 0.08926 > X.1 1 2.6603 2.6603 4.2977 > 0.05066 > Residuals 21 12.9991 0.619 > > With another stat software (JMP) > Y~X.1+X.2 > Df Sum Sq Mean Sq F value Pr(>F) > X.1 1 2.6603 2.6603 4.2977 > 0.05066 > X.2 1 0.5903 0.5903 0.9537 > 0.33991 > Residuals 21 12.9991 0.619 > > Y~X.2+X.1 > Df Sum Sq Mean Sq F value Pr(>F) > X.2 1 0.5903 0.5903 0.9537 > 0.33991 > X.1 1 2.6603 2.6603 4.2977 > 0.05066 > Residuals 21 12.9991 0.619 > > > -------------------------------------------------------------- > ------------- > Julien Martin > > Canadian Research Chair in behavioural ecology Universit?? du > Qu??bec ?? Montr??al > > Email: martin.julien.2 at courrier.uqam.ca > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
Please check if your independent variables or Xs are independent. If they are not that can affect the sequential decomposition. -- View this message in context: http://r.789695.n4.nabble.com/Anova-problem-with-order-of-terms-in-model-tp791744p4644320.html Sent from the R help mailing list archive at Nabble.com.