[R] semiparametric manova

David L Carlson dc@rl@on @ending from t@mu@edu
Tue Nov 13 04:19:11 CET 2018


With two variables there are no combinations with less than 2 observations. Here's the part of the data you provided:

> df <- structure(list(V1 = c(200, 200, 200, 200, 200, 200, 200, 200, 
200, 200, 200, 200, 200, 200, 200, 500, 500, 500, 500, 500, 500, 
500, 500, 500, 500, 350, 350, 350, 350, 350, 200, 200, 200, 200, 
200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 500, 500, 
500, 500, 500, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 
350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 500, 500, 500, 
500, 500, 500, 500, 500, 500, 500, 350, 350, 350, 350, 350, 500, 
500, 500, 500, 500), V2 = c(16, 16, 16, 16, 16, 8, 8, 8, 8, 8, 
8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
8, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 
8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 8, 8, 8, 8, 8, 16, 16, 16, 
16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 16, 
16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24), V3 = c(16, 16, 16, 
16, 16, 16, 16, 16, 16, 16, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 23, 
23, 23, 23, 23, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 23, 23, 23, 23, 
23, 23, 23, 23, 23, 23, 16, 16, 16, 16, 16, 9, 9, 9, 9, 9, 23, 
23, 23, 23, 23, 16, 16, 16, 16, 16, 23, 23, 23, 23, 23, 16, 16, 
16, 16, 16, 23, 23, 23, 23, 23, 16, 16, 16, 16, 16, 9, 9, 9, 
9, 9)), class = "data.frame", row.names = c(NA, -90L))

> xtabs(~V1+V2+V3, df) # There are 9 cells with 0 entries. That is the problem.
, , V3 = 9

     V2
V1    8 16 24
  200 5  0  5
  350 5  5  0
  500 0  5  5

, , V3 = 16

     V2
V1    8 16 24
  200 5  5  0
  350 0  5  5
  500 5  0  5

, , V3 = 23

     V2
V1    8 16 24
  200 0  5  5
  350 5  0  5
  500 5  5  0

> xtabs(~V1+V2, df)  # No cells < 2 with V1, V2
     V2
V1     8 16 24
  200 10 10 10
  350 10 10 10
  500 10 10 10
> xtabs(~V1+V3, df)  # No cells < 2 with V1, V3
     V3
V1     9 16 23
  200 10 10 10
  350 10 10 10
  500 10 10 10
> xtabs(~V2+V3, df)  # No cells < 2 with V2, V3
    V3
V2    9 16 23
  8  10 10 10
  16 10 10 10
  24 10 10 10


David L. Carlson
Department of Anthropology
Texas A&M University



-----Original Message-----
From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of Yectli Huerta via R-help
Sent: Monday, November 12, 2018 6:25 PM
To: r-help using r-project.org
Subject: Re: [R] semiparametric manova

thanks for the replies.

i don't believe the data is the problem. here you see how i used 3 variables and it fails,
but when i use any combination of 2 variables, it does work

> head(df)
   V1 V2 V3 V4 V5           V6           V7
1 200 16 16  3 64 5.584092e+13 1.616745e+12
2 200 16 16  3 64 5.589262e+13 1.715906e+12
3 200 16 16  3 64 5.588578e+13 1.714084e+12
4 200 16 16  3 64 5.588061e+13 1.651920e+12
5 200 16 16  3 64 5.589810e+13 1.624824e+12
6 200  8 16  1 48 5.585124e+13 1.689478e+12
> library(MANOVA.RM)
> df$V1
[1] 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 500 500 500 500
[20] 500 500 500 500 500 500 350 350 350 350 350 200 200 200 200 200 200 200 200
[39] 200 200 200 200 200 200 200 500 500 500 500 500 350 350 350 350 350 350 350
[58] 350 350 350 350 350 350 350 350 350 350 350 350 350 500 500 500 500 500 500
[77] 500 500 500 500 350 350 350 350 350 500 500 500 500 500
> df$V2
[1] 16 16 16 16 16  8  8  8  8  8  8  8  8  8  8 16 16 16 16 16  8  8  8  8  8
[26]  8  8  8  8  8 24 24 24 24 24 24 24 24 24 24 16 16 16 16 16  8  8  8  8  8
[51] 16 16 16 16 16  8  8  8  8  8 16 16 16 16 16 24 24 24 24 24 24 24 24 24 24
[76] 16 16 16 16 16 24 24 24 24 24 24 24 24 24 24
> df$V3
[1] 16 16 16 16 16 16 16 16 16 16  9  9  9  9  9  9  9  9  9  9 23 23 23 23 23
[26]  9  9  9  9  9  9  9  9  9  9 23 23 23 23 23 23 23 23 23 23 16 16 16 16 16
[51]  9  9  9  9  9 23 23 23 23 23 16 16 16 16 16 23 23 23 23 23 16 16 16 16 16
[76] 23 23 23 23 23 16 16 16 16 16  9  9  9  9  9
>
> MANOVA.wide(cbind(V6,V7)~V1*V2*V3,data=df,seed=1234)
Error in MANOVA.wide(cbind(V6, V7) ~ V1 * V2 * V3, data = df, seed = 1234) :
  There is at least one factor-level combination
           with less than 2 observations!

> MANOVA.wide(cbind(V6,V7)~V1*V2,data=df,seed=1234)
Call:
cbind(V6, V7) ~ V1 * V2

Wald-Type Statistic (WTS):
      Test statistic df p-value
V1            17.870  4   0.001
V2            20.392  4   0.000
V1:V2         24.127  8   0.002

....

> MANOVA.wide(cbind(V6,V7)~V1*V3,data=df,seed=1234)
Call:
cbind(V6, V7) ~ V1 * V3

Wald-Type Statistic (WTS):
      Test statistic df p-value
V1            18.566  4   0.001
V3            19.894  4   0.001
V1:V3         27.330  8   0.001

...
> MANOVA.wide(cbind(V6,V7)~V2*V3,data=df,seed=1234)
Call:
cbind(V6, V7) ~ V2 * V3

Wald-Type Statistic (WTS):
      Test statistic df p-value
V2            20.139  4   0.000
V3            19.947  4   0.001
V2:V3         32.088  8   0.000

....


More information about the R-help mailing list