[R] pairwise.t.test non numeric factors error

Erica Cseko Nolasco
Wed, 03 Jun 2015 17:14:17 -0000

Thanks Jim,

I removed the corresponding cases and tried again. What I discovery now is
if I run the function without paired = T (pairwise.t.test(x data$tss,data$pa) is
works. However, if I add the paired = T
(pairwise.t.test(x = data$tss,data$pa,paired = T) is gives me the error '
Error
in complete.cases(x, y) :   not all arguments have the same length'. In
fact it seems to do a paired test even without the paired = T argument.
I really don't know why.

Regards,

*Erica Csek? Nolasco*
Mestranda em Modelagem em Ci?ncias da Terra e do Ambiente
http://lattes.cnpq.br/2117508819823917
Universidade Estadual de Feira de Santana
Avenida Transnordestina s/n, Novo Horizonte
Feira de Santana - BA, Brasil CEP 44.036-900.

Graduate Student in Modeling of Environmental and Earth Sciences
http://lattes.cnpq.br/2117508819823917
Universidade Estadual de Feira de Santana
Transnordestina Ave, Novo Horizonte
Feira de Santana - BA, Brazil 44.036-900.


2015-06-02 22:34 GMT-03:00 Jim Lemon <drjimlemon at gmail.com>:

> Hi Erica,
> The problem may be that you are specifying a grouping factor (mdl) in
> which the group sizes are unequal. If one case in group "tot" is
> missing, is it possible to identify the corresponding cases in the
> other factor levels and delete them?
>
> Jim
>
>
> On Tue, Jun 2, 2015 at 11:59 PM, Erica Cseko Nolasco
> <ecnolasco at gmail.com> wrote:
> > Dear listers,
> >
> > I'm performing a PERMANOVA (adonis{vegan}) to compare the results
(ROC,
> > TSS) of models based on two factors (model, algo). I was not able to
> find a
> > pairwise test for adonis, on PRIMER it would be a Tukey test. Though,
I
> > chose to perform a pairwise.t.test what would be quite simple.
However,
> no
> > matter I rearrange my response and factor vectors (as a factor or
> numeric)
> > it gives me the following error (the code on the bottom - Error in
> > complete.cases(x, y) :
> >   not all arguments have the same length). I also tried to make a list
of
> > the vectors, but it also gives me the error 'Error in sort.list(y)
: 'x'
> > must be atomic for 'sort.list' Have you called 'sort'
on a list?'
> >
> > I would appreciate any suggestions to solve this issue.
> >
> > Best,
> >
> > Erica
> >
> >> setwd('D:\\Erica\\mestrado\\analises\\results')
> >> library(vegan)
> >>
rest=read.table('results_permanova.txt',sep="\t",header=T)
> >> rest$modelN=as.numeric(rest$model)
> >> rest$algoN=as.numeric(rest$algo)
> >> data=rest[complete.cases(rest),]
> >> head(data)
> >   algo   pa  run model   ROC   TSS modelN algoN
> > 1  ANN  PA1 RUN1   alt 0.947 0.867      2     2
> > 2  ANN PA10 RUN1   alt 0.978 0.869      2     2
> > 3  ANN PA11 RUN1   alt 0.993 0.931      2     2
> > 4  ANN PA12 RUN1   alt 0.961 0.845      2     2
> > 5  ANN PA13 RUN1   alt 0.988 0.960      2     2
> > 6  ANN PA14 RUN1   alt 0.996 0.988      2     2
> >> summary(data)
> >       algo           pa         run             model           ROC
> >      TSS
> >  CTA    :240   PA10   : 120       :   0   alt      : 200   Min.
:0.5290
> > Min.   :0.0580
> >  FDA    :240   PA11   : 120   RUN1:2399   altPet   : 200   1st
Qu.:0.8780
> > 1st Qu.:0.7160
> >  GAM    :240   PA12   : 120               b1       : 200   Median
:0.9350
> > Median :0.8270
> >  GBM    :240   PA13   : 120               b13      : 200   Mean
:0.9184
> > Mean   :0.7988
> >  GLM    :240   PA14   : 120               b13PETalt: 200   3rd
Qu.:0.9790
> > 3rd Qu.:0.9110
> >  MARS   :240   PA15   : 120               b14      : 200   Max.
:1.0000
> > Max.   :1.0000
> >  (Other):959   (Other):1679               (Other)  :1199
> >
> >      modelN           algoN
> >  Min.   : 2.000   Min.   : 2.000
> >  1st Qu.: 4.500   1st Qu.: 4.000
> >  Median : 7.000   Median : 7.000
> >  Mean   : 7.498   Mean   : 6.502
> >  3rd Qu.:10.000   3rd Qu.: 9.000
> >  Max.   :13.000   Max.   :11.000
> >
> >> tss=data$TSS
> >> summary(tss)
> >    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> >  0.0580  0.7160  0.8270  0.7988  0.9110  1.0000
> >> mdl=factor(data$model)
> >> summary(mdl)
> >       alt    altPet        b1       b13 b13PETalt       b14       b18
> >  b7       pet      pluv
> >       200       200       200       200       200       200       200
> > 200       200       200
> >      temp       tot
> >       200       199
> >> length(complete.cases(mdl,tss))
> > [1] 2399
> >> pairwise.t.test(tss,mdl,p.adj='bonf',paired=T,pool.sd =
FALSE)
> > Error in complete.cases(x, y) :
> >   not all arguments have the same length
> >>
> >
> > *Erica Csek? Nolasco*
> > Mestranda em Modelagem em Ci?ncias da Terra e do Ambiente
> > http://lattes.cnpq.br/2117508819823917
> > Universidade Estadual de Feira de Santana
> > Avenida Transnordestina s/n, Novo Horizonte
> > Feira de Santana - BA, Brasil CEP 44.036-900.
> >
> > Graduate Student in Modeling of Environmental and Earth Sciences
> > http://lattes.cnpq.br/2117508819823917
> > Universidade Estadual de Feira de Santana
> > Transnordestina Ave, Novo Horizonte
> > Feira de Santana - BA, Brazil 44.036-900.
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>

	[[alternative HTML version deleted]]