Hi Tal,

The problem is not the analysis, but the data. You have 2 weeks that only
have a value 4, and 31 out of 39 cases that only have a value 4. Your
residual matrix is thus malformed, and has a lower rank than the amount of
weeks minus 1. This makes it impossible to do the calculations in the Anova
procedure. Even when dropping the weeks where the value is 4 for every case,
the analysis can't be performed.

Cheers
Joris

What is it you want to know exactly?
On Thu, May 6, 2010 at 11:57 AM, Tal Galili <tal.gal...@gmail.com> wrote:

> Hello all,
>
> I am getting the following error:
>
> Error in linear.hypothesis.mlm(mod, hyp.matrix.1, SSPE = SSPE, V = V,  :
>  The error SSP matrix is apparently of deficient rank = 7 < 11
>
> After running:
> mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
> (av.ok <- Anova(mod.ok, idata=idata, idesign=~week))
>
> Although if I jitter the data in "dat", the function seems to work.
>
> What should I do ?
>
> (here is a self sufficient example code of my situation)
>
>
>
>
>
> #------------- R code --------------------
>
> # creating data
> idata <- structure(list(week = structure(1:12, .Label = c("week6", "week7",
> "week8", "week9", "week10", "week11", "week12", "week13", "week14",
>  "week15", "week16", "week17"), class = "factor")), .Names = "week",
> row.names = c(NA,
> -12L), class = "data.frame")
>
> dat <- structure(list(DC = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
>  2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label =
> c("control",
> "head (20g)"), class = "factor"), week6 = c(4, 4, 4, 4, 4, 4,
>  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), week7 = c(4, 4, 4, 4, 4,
>  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
> 4, 4, 4, 4,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4, 4, 4, 3), week16 = c(4,
>  4, 2, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
> 4, 4, 0, 4, 3, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 3), week17 = c(4,
>  4, 1, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
> 4, 4, 0, 4, 2, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 3)), .Names = c("DC",
>  "week6", "week7", "week8", "week9", "week10", "week11", "week12",
> "week13", "week14", "week15", "week16", "week17"), class = c("cast_df",
>  "data.frame"), row.names = c(NA, 39L))
> # This fails
> mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
> (av.ok <- Anova(mod.ok, idata=idata, idesign=~week))
>
> # But this works
> dat[,-1] <- apply(dat[,-1],2, jitter )
> mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
> (av.ok <- Anova(mod.ok, idata=idata, idesign=~week))
>
> #------------- R code --------------------
>
>
> Thanks in advance,
> Tal
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> ----------------------------------------------------------------------------------------------
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>



-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to