Dear Greg, thanks so much. Now I understand!!!!!! Thanks!!
________________________________ From: Greg Snow <greg.s...@imail.org> <r-help@r-project.org> Sent: Wed, January 5, 2011 11:27:53 PM Subject: RE: [R] Comparing fitting models The output with all three fits gives you 2 comparisons, fit1 vs. fit2 and fit2 vs. fit3. So using an alpha of 0.05, the 0.99 p-value is comparing model 2 (fit2) and model 3 (fit1) and testing the null that they fit equally well with the differences being due to random chance. The p-value is large so we cannot reject that fit2 fits as well as fit1, so the interaction is not significantly different. Then the 0.23 p-value compares the models with and without stimulus (the interaction not being considered), again the p-value is larger than alpha so we donât have the evidence to conclude that stimulus helps. If you want to test stimulus and the interaction in a single step, then do anova(fit3, fit1), giving the anova does the sequential tests. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 Sent: Wednesday, January 05, 2011 2:46 PM To: Greg Snow; r-help@r-project.org Subject: Re: [R] Comparing fitting models Dear Greg, thanks for your answer, but that is not the point. My question is another: from the data in the R prompt how can I compare the models? I don´t understand the output of anova(fit1, fit2, fit3) What I have to look to understand something about the comparison of the models? Look the output in R: > anova(fit3, fit2, fit1) #compare models Analysis of Variance Table Model 1: response ~ condition Model 2: response ~ stimulus + condition Model 3: response ~ stimulus + condition + stimulus:condition Res.Df RSS Df Sum of Sq F Pr(>F) 1 171 382.78 2 165 364.13 6 18.650 1.3628 0.2328 3 159 362.67 6 1.465 0.1071 0.9955 I don´t understand these data...what they say actually about the comparison between the three models? Please enlighten me. Thanks a lot ________________________________ From:Greg Snow <greg.s...@imail.org> <r-help@r-project.org> Sent: Wed, January 5, 2011 10:34:15 PM Subject: RE: [R] Comparing fitting models Just do anova(fit3, fit1) This compares those 2 models directly. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Frodo Jedi > Sent: Wednesday, January 05, 2011 10:10 AM > To: r-help@r-project.org > Subject: [R] Comparing fitting models > > > Dear all, > I have 3 models (from simple to complex) and I want to compare them in > order to > see if they fit equally well or not. > From the R prompt I am not able to see where I can get this > information. > Let´s do an example: > > fit1<- lm(response ~ stimulus + condition + stimulus:condition, > data=scrd) > #EQUIVALE A lm(response ~ stimulus*condition, data=scrd) > > > fit2<- lm(response ~ stimulus + condition, data=scrd) > > fit3<- lm(response ~ condition, data=scrd) > > > > anova(fit2, fit1) #compare models > Analysis of Variance Table > > Model 1: response ~ stimulus + condition > Model 2: response ~ stimulus + condition + stimulus:condition > Res.Df RSS Df Sum of Sq F Pr(>F) > 1 165 364.13 > 2 159 362.67 6 1.4650 0.1071 0.9955 > > > > anova(fit3, fit2, fit1) #compare models > Analysis of Variance Table > > Model 1: response ~ condition > Model 2: response ~ stimulus + condition > Model 3: response ~ stimulus + condition + stimulus:condition > Res.Df RSS Df Sum of Sq F Pr(>F) > 1 171 382.78 > 2 165 364.13 6 18.650 1.3628 0.2328 > 3 159 362.67 6 1.465 0.1071 0.9955 > > > > How can I understand that the simple model fits as good as the complex > model > (the one with the interaction)? > > Thanks in advance > > All the best > > > > [[alternative HTML version deleted]] [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.