[R] Anova(car) SS digits
John Fox
jfox at mcmaster.ca
Thu Nov 29 21:11:24 CET 2007
Dear Tyler,
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Tyler Smith
> Sent: Thursday, November 29, 2007 2:07 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Anova(car) SS digits
>
> Hi,
>
> When I use Anova(car) to produce type III SS, 'Sum Sq' is reported in
> integers:
>
> > Anova(bot.lm3, type ="III")
> Anova Table (Type III tests)
>
> Response: bottemp
> Sum Sq Df F value Pr(>F)
> (Intercept) 45295 1 29436.4440 < 2e-16
> fungroup 3 2 0.8259 0.44006
> numsp.fun 11 2 3.4503 0.03460
> block 419 4 68.0017 < 2e-16
> fungroup:numsp.fun 6 4 1.0317 0.39340
> fungroup:block 9 8 0.7429 0.65346
> numsp.fun:block 12 8 0.9501 0.47795
> fungroup:numsp.fun:block 27 16 1.0920 0.36882
> Residuals 205 133
>
> I have tried specifying digits = 7 in the call to Anova, but
> that doesn't change anything. The output from another stats
> program for the same data confirms that the ouptut above is
> correct, but is rounded to the nearest integer. The dataset
> is too large to post here, but I can confirm that I get the
> expected results from the examples in ?Anova, as well as for
> type = 'II' on my own data. This output, and relevant
> options() and sessionInfo are pasted below. What am I doing wrong?
Anova() creates an object of class "anova" which then gets printed by the
print method for "anova" objects. The reason that the sums of squares for
the type II tests are rounded like this is because of the large value for
the intercept. Although Anova() doesn't take a digits argument,
print.anova() does, and so, e.g., you could use the command
print(Anova(bot.lm3, type ="III"), digits=7)
I hope this helps,
John
>
> Thanks,
>
> Tyler
>
> > mod <- lm(conformity ~ fcategory*partner.status, data=Moore,
> + contrasts=list(fcategory=contr.sum,
> partner.status=contr.sum))
> > Anova(mod)
> Anova Table (Type II tests)
>
> Response: conformity
> Sum Sq Df F value Pr(>F)
> fcategory 11.61 2 0.2770 0.759564
> partner.status 212.21 1 10.1207 0.002874
> fcategory:partner.status 175.49 2 4.1846 0.022572
> Residuals 817.76 39
> > Anova(mod, type="III")
> Anova Table (Type III tests)
>
> Response: conformity
> Sum Sq Df F value Pr(>F)
> (Intercept) 5752.8 1 274.3592 < 2.2e-16
> fcategory 36.0 2 0.8589 0.431492
> partner.status 239.6 1 11.4250 0.001657
> fcategory:partner.status 175.5 2 4.1846 0.022572
> Residuals 817.8 39
>
> > Anova(bot.lm3, type ="II")
> Anova Table (Type II tests)
>
> Response: bottemp
> Sum Sq Df F value Pr(>F)
> fungroup 1.87 2 0.6069 0.54656
> numsp.fun 11.14 2 3.6214 0.02942
> block 486.47 4 79.0379 < 2e-16
> fungroup:numsp.fun 6.32 4 1.0275 0.39553
> fungroup:block 11.43 8 0.9283 0.49542
> numsp.fun:block 11.29 8 0.9169 0.50473
> fungroup:numsp.fun:block 26.89 16 1.0920 0.36882
> Residuals 204.65 133
>
> > options('digits')
> $digits
> [1] 7
>
> > options('contrasts')
> $contrasts
> [1] "contr.sum" "contr.poly"
>
> > sessionInfo()
> R version 2.5.1 (2007-06-27)
> i486-pc-linux-gnu
>
> locale:
>
> LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLA
> TE=en_CA.UTF-8;
> LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA
> .UTF-8;LC_NAME=C;
> LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDEN
> TIFICATION=C
>
> attached base packages:
> [1] "stats" "graphics" "grDevices" "utils"
> "datasets" "methods"
> [7] "base"
>
> other attached packages:
> car
> "1.2-7"
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list