From: Joris Meys <jorismeys_at_gmail.com>

Date: Fri, 04 Jun 2010 00:38:45 +0200

Date: Fri, 04 Jun 2010 00:38:45 +0200

Could you copy the data?

Data <- data.frame(C.Mean,Mean.richness,Zoop,Diversity,Phyto) dput(Data)

I have the feeling something's wrong there. I believe you have 48 observations (47df + 1 for the intercept), 2 levels of Diversity, 4 of Phyto and 48/(3*4)=4 levels of Zoop. But you don't have 3df for Zoop. Either I'm way off, or what goes in the lm is not what you think it is.

I tried a small sample with the datastructure I believe you have, but I couldn't reproduce your error.

## Run

Phyto <- as.factor(rep(rep(c("A","B","C","D"),each=6),2))
Diversity <- as.factor(rep(c("High","Low"),each=24))
Zoop <- rep(c(1,2,3,4),times=12)

C.Mean <- rnorm(48)

Mean.richness <-rnorm(48)

test <- lm(C.Mean~ Mean.richness + Diversity + Zoop + Diversity/Phyto + Zoop*Diversity/Phyto)

Anova(test,type="III")

Zoop <- as.factor(Zoop)

Anova(test,type="III")

## End Run

Cheers

Joris

On Thu, Jun 3, 2010 at 10:26 PM, Anita Narwani <anitanarwani_at_gmail.com>wrote:

> I would just like to add that when I remove the co-variate of Mean.richness

*> from the model (i.e. eliminating the non-orthogonality), the aliasing
**> warning is replaced by the following error message:
**> "Error in t(Z) %*% ip : non-conformable arguments"
**>
**> That is when I enter this model:
**> carbonmean<-lm(C.Mean~ Diversity + Zoop + Diversity/Phyto +
**> Zoop*Diversity/Phyto)
**>
**>
**>
**>
**>
**>
**>
**> On Wed, Jun 2, 2010 at 6:05 PM, Joris Meys <jorismeys_at_gmail.com> wrote:
**>
**>> that's diversity/phyto, zoop or phyto twice in the formula.
**>>
**>>
**>> On Thu, Jun 3, 2010 at 3:00 AM, Joris Meys <jorismeys_at_gmail.com> wrote:
**>>
**>>> That's what one would expect with type III sum of squares. You have Phyto
**>>> twice in your model, but only as a nested factor. To compare the full model
**>>> with a model without diversity of zoop, you have either the combination
**>>> diversity/phyto, zoop/phyto or phyto twice in the formula. That's aliasing.
**>>>
**>>> Depending on how you stand on type III sum of squares, you could call
**>>> that a "bug". Personally, I'd just not use them.
**>>>
**>>> https://stat.ethz.ch/pipermail/r-help/2001-October/015984.html
**>>>
**>>> Cheers
**>>> Joris
**>>>
**>>>
**>>> On Thu, Jun 3, 2010 at 2:13 AM, Anita Narwani <anitanarwani_at_gmail.com>wrote:
**>>>
**>>>> Hello,
**>>>>
**>>>> I have been trying to get an ANOVA table for a linear model containing a
**>>>> single nested factor, two fixed factors and a covariate:
**>>>>
**>>>> carbonmean<-lm(C.Mean~ Mean.richness + Diversity + Zoop +
**>>>> Diversity/Phyto +
**>>>> Zoop*Diversity/Phyto)
**>>>>
**>>>>
**>>>>
**>>>> where, *Mean.richness* is a covariate*, Zoop* is a categorical variable
**>>>> (the
**>>>> species), *Diversity* is a categorical variable (Low or High), and
**>>>> *Phyto*(community composition) is also categorical but is nested
**>>>> within the level
**>>>> of *Diversity*. Quinn & Keough's statistics text recommends using Type
**>>>> III
**>>>> SS for a nested ANOVA with a covariate.
**>>>>
**>>>> I get the following output using the Type I SS ANOVA:
**>>>>
**>>>>
**>>>>
**>>>> Analysis of Variance Table
**>>>> Response: C.Mean
**>>>> Df Sum Sq
**>>>> Mean
**>>>> Sq F value Pr(>F)
**>>>> Mean.richness 1 56385326 56385326
**>>>> 23.5855 3.239e-05 ***
**>>>> Diversity 1 14476593
**>>>> 14476593
**>>>> 6.0554 0.019634 *
**>>>> Zoop 1 13002135
**>>>> 13002135
**>>>> 5.4387 0.026365 *
**>>>> Diversity:Phyto 6 126089387 21014898
**>>>> 8.7904 1.257e-05 ***
**>>>> Diversity:Zoop 1 263036
**>>>> 263036
**>>>> 0.1100 0.742347
**>>>> Diversity:Zoop:Phyto 6 61710145 10285024
**>>>> 4.3021
**>>>> 0.002879 **
**>>>> Residuals 31 74110911
**>>>> 2390675
**>>>>
**>>>> I have tried using both the drop1() command and the Anova() command in
**>>>> the
**>>>> car package.
**>>>>
**>>>> When I use the Anova command I get the following error message:
**>>>>
**>>>> >Anova(carbonmean,type="III")
**>>>>
**>>>> “Error in linear.hypothesis.lm(mod, hyp.matrix, summary.model = sumry,:
**>>>> One
**>>>> or more terms aliased in model.”
**>>>>
**>>>>
**>>>>
**>>>> I am not sure why this is aliased. There are no missing cells, and the
**>>>> cells
**>>>> are balanced (aside from for the covariate). Each Phyto by Zoop cross is
**>>>> replicated 3 times, and there are four Phyto levels within each level of
**>>>> Diversity. When I remove the nested factor (Phyto), I am able to get the
**>>>> Type III SS output.
**>>>>
**>>>>
**>>>>
**>>>> Then when I use drop1(carbonmean,.~.,Test=”F”) I get the following
**>>>> output:
**>>>>
**>>>> > drop1(carbonmean,.~.,Test="F")
**>>>>
**>>>> Single term deletions
**>>>>
**>>>>
**>>>>
**>>>> Model:
**>>>>
**>>>> C.Mean ~ Mean.richness + Diversity + Zoop + Diversity/Phyto + Zoop *
**>>>> Diversity/Phyto
**>>>>
**>>>> Df Sum of Sq
**>>>> RSS AIC
**>>>>
**>>>> <none> 74110911 718
**>>>>
**>>>> Mean.richness 1 49790403
**>>>> 123901314
**>>>> 741
**>>>>
**>>>> Diversity 0 0
**>>>> 74110911 718
**>>>>
**>>>> Zoop 0 0
**>>>> 74110911 718
**>>>>
**>>>> Diversity:Phyto 6 118553466 192664376
**>>>> 752
**>>>>
**>>>> Diversity:Zoop 0 -1.49e-08
**>>>> 74110911
**>>>> 718
**>>>>
**>>>> Diversity:Zoop:Phyto 6 61710145 135821055
**>>>> 735
**>>>>
**>>>>
**>>>>
**>>>> There are zero degrees of freedom for Diversity, Zoop and their
**>>>> interaction,
**>>>> and zero sums of sq for Diversity and Zoop. This cannot be correct,
**>>>> however
**>>>> when I do the model simplification by dropping terms from the models
**>>>> manually and comparing them using anova(), I get virtually the same
**>>>> results.
**>>>>
**>>>>
**>>>>
**>>>> I would appreciate any suggestions for things to try or pointers as to
**>>>> what
**>>>> I may be doing incorrectly.
**>>>>
**>>>>
**>>>>
**>>>> Thank you.
**>>>>
**>>>> Anita Narwani.
**>>>>
**>>>> [[alternative HTML version deleted]]
**>>>>
**>>>>
**>>>> ______________________________________________
**>>>> R-help_at_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.Meys_at_Ugent.be
**>>> -------------------------------
**>>> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
**>>>
**>>
**>>
**>>
**>> --
**>> 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.Meys_at_Ugent.be
**>> -------------------------------
**>> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
**>>
**>
**>
*

-- 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.Meys_at_Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[alternative HTML version deleted]]Received on Thu 03 Jun 2010 - 22:40:57 GMT______________________________________________ R-help_at_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.

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Thu 03 Jun 2010 - 22:50:27 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*