An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110105/93af8de7/attachment.pl>
Comparing fitting models
5 messages · Frodo Jedi, Greg Snow
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]]
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110105/bd44fb33/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110105/b86b21a5/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110105/e6b6f9f5/attachment.pl>