[R] pairwise.t.test: empty p-table

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue May 2 22:20:18 CEST 2006


Thomas Hoffmann <thomas.hoffmann at uni-bonn.de> writes:

> Hi list-members
> 
> can anybody tell me why
> 
>  > pairwise.t.test(val, fac)
> 
> produces an empty p-table. As shown below:
> 
> 
>         Pairwise comparisons using t tests with pooled SD
> 
> data:  val and fac
> 
>        AS AT Fhh Fm Fmk Fmu GBS Gf HFS Hn jAL Kol R_Fill
> AT     -  -  -   -  -   -   -   -  -   -  -   -   -    
> Fhh    -  -  -   -  -   -   -   -  -   -  -   -   -    
> Fm     -  -  -   -  -   -   -   -  -   -  -   -   -    
> Fmk    -  -  -   -  -   -   -   -  -   -  -   -   -    
> Fmu    -  -  -   -  -   -   -   -  -   -  -   -   -    
> GBS    -  -  -   -  -   -   -   -  -   -  -   -   -    
> Gf     -  -  -   -  -   -   -   -  -   -  -   -   -    
> HFS    -  -  -   -  -   -   -   -  -   -  -   -   -    
> Hn     -  -  -   -  -   -   -   -  -   -  -   -   -    
> jAL    -  -  -   -  -   -   -   -  -   -  -   -   -    
> Kol    -  -  -   -  -   -   -   -  -   -  -   -   -    
> R_Fill -  -  -   -  -   -   -   -  -   -  -   -   -    
> Sa     -  -  -   -  -   -   -   -  -   -  -   -   -    
> 
> However val and fac do have the same length and are not empty:
>  > summary(fac)
>     AS     AT    Fhh     Fm    Fmk    Fmu    GBS     Gf    HFS     Hn    
> jAL    Kol R_Fill     Sa
>     50     14      7     35     14     25     59     51     90     
> 65     12     26     96     26
>  > summary(val)
>     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's
>   0.0000   0.1744   0.6395   2.1540   1.7440  40.1200 223.0000

Does table(fac[!is.na(val)]) show any groups with 1 or less
observations? 

The construction

        s <- tapply(x, g, sd, na.rm = TRUE)
        n <- tapply(!is.na(x), g, sum)
        degf <- n - 1
        total.degf <- sum(degf)
        pooled.sd <- sqrt(sum(s^2 * degf)/total.degf)

is prone to give NA in such cases.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list