# R-beta: New user - looking for help with ANOVA

Pete Phillips pete at smtl.co.uk
Fri Mar 13 14:46:18 CET 1998

```Hi

I've just installed R on our Sun kit in the lab and on my Linux box at home.

My statistical expertise is not advanced - I have completed Open
University probability and statistics courses, and been using
Gary Perlmans !STAT package for analyses of variance, descriptive
stats, linear regression, non-parametric stats etc for 10 years or so.
(so be gentle with me :-) )

However, R is clearly a much more powerful package, which is still
being developed (the Perlman package appears to be static) and
includes superb graphics facilities.

I have got to grips with linear regression with R, but am having
problems with anova.   It seems to me (but I may be wrong) that the
examples in the "Notes on R" paper include anova, but R doesn't
currently support this ?

The type of anova we routinely carry out is similar to this from
Armitage (p 230):

# Subj  Sex     Mstrain Fstrain wt
1       f       1       1       0.93
2       f       1       1       1.7
3       m       1       1       0.69
4       m       1       1       0.83
5       f       1       2       1.76
6       f       1       2       1.58
....

60      m       4       3       1.11
61      f       4       4       1.85
62      f       4       4       1.38
63      m       4       4       0.43
64      m       4       4       0.59

Running this through 'anova' like this:

striphash < armitage-p230 |  anova subj sex mstrain fstrain wt

(strip hash is sed script to strip comments out), I get SOURCE analyses
(not included below - too big) followed by an analyses of variance
table:

FACTOR  :       Subj        sex    mstrain    fstrain         wt
LEVELS  :         64          2          4          4         64
TYPE    :     RANDOM    BETWEEN    BETWEEN    BETWEEN       DATA

SOURCE                SS     df             MS         F      p
===============================================================
mean            105.5499      1       105.5499  2670.566  0.000 ***
S/smf             1.2648     32         0.0395

sex              14.8900      1        14.8900   376.737  0.000 ***
S/smf             1.2648     32         0.0395

mstrain           0.3396      3         0.1132     2.864  0.052
S/smf             1.2648     32         0.0395

sm                0.3945      3         0.1315     3.327  0.032 *
S/smf             1.2648     32         0.0395

fstrain           0.2401      3         0.0800     2.025  0.130
S/smf             1.2648     32         0.0395

sf                0.0245      3         0.0082     0.206  0.891
S/smf             1.2648     32         0.0395

mf                1.2987      9         0.1443     3.651  0.003 **
S/smf             1.2648     32         0.0395

smf               0.2613      9         0.0290     0.735  0.675
S/smf             1.2648     32         0.0395

Is there any way to do this analyses in R ?  Or am I on the wrong
track here ?

A secondary question - we recently had a student to some research on
maggot growth (we use maggots to clean patients wounds), and her
University supervisor used SAS or somesuch to do the analyses.  The
analyses of variance was identical to my results with the |STAT anova,
but he also did some post-anova work, called a Tukey analyses.  As far
as I can see, if your anova tells you that there are differences
between your factors, the Tukey analyses helps you determine where
those differences are.

Is it possible to do this analyses in R ?

Apologies for the length of this.
Hope someone can help/clarify.

Regards,
Pete
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```

More information about the R-help mailing list