[R] Error in linearHypothesis.mlm: The error SSP matrix is apparently of deficient rank

Jara, Jose (Dr.) jaj9 at leicester.ac.uk
Tue Jan 31 13:48:08 CET 2012


Hi,

I have encountered this error when attempting a One-way Repeated-measure ANOVA
with my data.

I have read the "Anova in car: SSPE apparently deficient rank" thread
by I'm not sure the within-subject interaction has more degrees of freedom
than subjects in my case.

I have prepared the following testing script:

     rm(list = ls())
     suppressMessages(require("plyr"))
     suppressMessages(require(ez))
     
     source.file <- file.path(path.expand("~"), "test-data.csv")
     data <- read.csv(source.file, stringsAsFactors = TRUE)
     data$Participant <- as.factor(data$Participant)
     
     summary(data)
     colwise(class)(data)
     colwise(mode)(data)
     colwise(mean)(data[3:4])
     colwise(sd)(data[3:4])
     
     ops <- options(contrasts = c('contr.sum', 'contr.poly'))
     
     ezANOVA(data, dv = .(Measure.2), wid = .(Participant), within = .(Factor), type = 3, detailed = T)
     
     ezANOVA(data, dv = .(Measure.1), wid = .(Participant), within = .(Factor), type = 3, detailed = T)
     
     options(ops)


I get a model from the first call to ezANOVA, but the deficient rank error from the second
(script's output pasted below, data file attached). Measure.1 is my real data, Measure.2 is
artificial (rnorm) with same mean and sd than Measure.1.

Could someone explain to me why it seems that the VALUES in the dependent variable
seem to determine a deficient rank error?

Regards
Jose


Script's output:



> #! /usr/bin/Rscript
> 
> rm(list = ls())

> suppressMessages(require("plyr"))

> suppressMessages(require(ez))

> source.file <- file.path(path.expand("~"), "test-data.csv")

> data <- read.csv(source.file, stringsAsFactors = TRUE)

> data$Participant <- as.factor(data$Participant)

> summary(data)
  Participant      Factor     Measure.1         Measure.2      
 1      :  6   level.1:36   Min.   :0.05798   Min.   :-0.0408  
 2      :  6   level.2:36   1st Qu.:0.13437   1st Qu.: 0.1233  
 3      :  6   level.3:36   Median :0.16444   Median : 0.1830  
 4      :  6   level.4:36   Mean   :0.19196   Mean   : 0.1837  
 5      :  6   level.5:36   3rd Qu.:0.23620   3rd Qu.: 0.2329  
 6      :  6   level.6:36   Max.   :0.48600   Max.   : 0.4281  
 (Other):180                                                   

> colwise(class)(data)
  Participant Factor Measure.1 Measure.2
1      factor factor   numeric   numeric

> colwise(mode)(data)
  Participant  Factor Measure.1 Measure.2
1     numeric numeric   numeric   numeric

> colwise(mean)(data[3:4])
  Measure.1 Measure.2
1 0.1919628 0.1836579

> colwise(sd)(data[3:4])
   Measure.1  Measure.2
1 0.08840518 0.08452272

> ops <- options(contrasts = c('contr.sum', 'contr.poly'))

> ezANOVA(data, dv = .(Measure.2), wid = .(Participant), within = .(Factor),
+         type = 3, detailed = T)
Note: model has only an intercept; equivalent type-III tests substituted.
$ANOVA
       Effect DFn DFd        SSn       SSd           F            p p<.05        ges
1 (Intercept)   1  35 7.28572868 0.2792041 913.3121882 1.145682e-26     * 0.82856098
2      Factor   5 175 0.02847626 1.2282989   0.8114224 5.429559e-01       0.01853948

$`Mauchly's Test for Sphericity`
  Effect         W         p p<.05
2 Factor 0.6144546 0.3073226      

$`Sphericity Corrections`
  Effect       GGe     p[GG] p[GG]<.05       HFe     p[HF] p[HF]<.05
2 Factor 0.8480886 0.5258849           0.9795716 0.5408084          


> ezANOVA(data, dv = .(Measure.1), wid = .(Participant), within = .(Factor),
+         type = 3, detailed = T)
Note: model has only an intercept; equivalent type-III tests substituted.
Error in linearHypothesis.mlm(mod, hyp.matrix, SSPE = SSPE, idata = idata,  : 
  The error SSP matrix is apparently of deficient rank = 4 < 5
Error in ezANOVA_main(data = data, dv = dv, wid = wid, within = within,  : 
  The car::Anova() function used to compute results and assumption tests seems to have failed. Most commonly this is because you have too few subjects relative to the number of cells in the within-Ss design. It is possible that trying the ANOVA again with "type=1" may yield results (but definitely no assumption tests).
> 


More information about the R-help mailing list