[R] Anova

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 12 21:10:51 CEST 2008


You are trying to do ANOVA on a categorical response.

> How can I solve this?

Use a more appropriate model.  Did you mean ML to be the response and Grup 
the group rather than v.v.?  Then try

aov(ML ~ Grup, data = GBM)

On Tue, 12 Aug 2008, Dani Valverde wrote:

> Hello,
> I am trying to perform an ANOVA on a dataframe like this:
>
>             ID Grup      ML              PC                  mI 
> Gly             Glx
> X373.txt     1    1 0.004685889  0.05994939 0.004589104   0.007144027 
> 0.02042549
> X373bis.txt  2    1 0.004685889   0.0599494 0.004589104   0.007144028 
> 0.0204255
> X376.txt     3    1 0.007604898  0.07600049  0.01935247    0.01678972 
> 0.03363403
> X392.txt     4    1 0.004982747  0.02760991  0.01855596    0.01413439 
> 0.02013267
> X483.txt     5    1 0.009131522  0.02636227  0.02485232    0.01493074 
> 0.02532194
> X520.txt     6    1 0.008553895  0.06304886  0.02490261    0.01907819 
> 0.03356447
> X671.txt     7    1 0.008004383  0.05243909   0.0229447      0.024266 
> 0.03553224
> X673A.txt    8    1  0.01306893  0.02799318  0.01155338   0.007668364 
> 0.02123958
> X673B.txt    9    1 0.006099385   0.0516078  0.03099324    0.02664487 
> 0.03766267
> X674.txt    10    1 0.005476397  0.04945545  0.01479742    0.01084873 
> 0.02307815
> X681.txt    11    1 0.009807893  0.01680487 0.004524913   0.004705414 
> 0.008969453
> X725.txt    12    1  0.01018343   0.0119391 0.007911063   0.008005791 
> 0.01014625
> X746.txt    13    1 0.008864319  0.02484126  0.01198048    0.01276371 
> 0.01042683
> X772.txt    14    1 0.005966057  0.07398342   0.0210399    0.01606057 
> 0.02932874
> X814.txt    15    1  0.01350947   0.0317243 0.003234958   0.002958675 
> 0.005194511
> X835.txt    16    1 0.005509359  0.02670237  0.07425323    0.04095533 
> 0.031017
> X847.txt    17    1 0.004784228  0.05349206  0.01183679    0.01230316 
> 0.03073348
> X851.txt    18    1 0.004395889  0.03812635  0.01998653    0.02165763 
> 0.02074277
> X865.txt    19    1 0.001514055  0.07128447   0.0106887    0.00802192 
> 0.01478855
> X878.txt    20    1 0.003693918  0.03864821  0.01571797    0.01972568 
> 0.022711
> et2029.txt  21    1  0.05204285  0.03769878  0.03168799    0.03631842 
> 0.02732589
> et2348.txt  22    1  0.01407517  0.01679014 0.004900163   0.004243802 
> 0.01052361
>
> The table is truncated because it's very big, but it has 3 different groups 
> (Grup variable) and it's called GBM.
> I try to use the command:
>
> aov(GBM$Grup~GBM$ML,data=GBM)
>
> But I get this error:
>
> /Error in storage.mode(y) <- "double" :
> invalid to change the storage mode of a factor
> In addition: Warning message:
> In model.response(mf, "numeric") :
> using type="numeric" with a factor response will be ignored/
>
> How can I solve this?
> Best,
>
> Dani
>
> -- 
> Daniel Valverde Saubí
>
> Grup de Biologia Molecular de Llevats
> Facultat de Veterinària de la Universitat Autònoma de Barcelona
> Edifici V, Campus UAB
> 08193 Cerdanyola del Vallès- SPAIN
>
> Centro de Investigación Biomédica en Red
> en Bioingeniería, Biomateriales y
> Nanomedicina (CIBER-BBN)
>
> Grup d'Aplicacions Biomèdiques de la RMN
> Facultat de Biociències
> Universitat Autònoma de Barcelona
> Edifici Cs, Campus UAB
> 08193 Cerdanyola del Vallès- SPAIN
> +34 93 5814126
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list