Just do anova(fit3, fit1)
This compares those 2 models directly.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Frodo Jedi
> Sent: Wednesday, January 05, 2011 10:10 AM
> To: r-help at 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]]