MANOVA polynomial contrasts
Dear Gian, How contrasts are created by default is controlled by the contrasts option:
getOption("contrasts")
unordered ordered "contr.treatment" "contr.poly" So, unless you've changed this option, contr.poly() will be used to generate orthogonal polynomial contrasts for an ordered factor, and you therefore need do nothing special to get this result. For example:
(f <- ordered(sample(letters[1:3], 10, replace=TRUE)))
[1] c c a a c c b c a c Levels: a < b < c
round(contrasts(f), 4)
.L .Q [1,] -0.7071 0.4082 [2,] 0.0000 -0.8165 [3,] 0.7071 0.4082 For more information, see section 11 on statistical models in the manual "An Introduction to R," which is part of the standard R distribution, and in particular sections 11.1 and 11.1.1. I hope that this clarifies the issue. Best, John ------------------------------------------------ John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Wed, 25 Jul 2012 11:58:30 +0200
"Manzoni, GianMauro" <gm.manzoni at auxologico.it> wrote:
Dear Greg Snow, thank you very much for your suggestions. However, I need an example in order to understand fully. I was told that, given the ordinal factor, I do not need to specify the contr.poly function because R does it automatically. However, I don not know if I have to add an argument into the manova/anova function or something else. Please write me an illustrative example. Many thanks. Best regards, Gian Mauro Manzoni 2012/7/25 Greg Snow <538280 at gmail.com>
You should not need to write them yourself. Look at the contr.poly function along with the C function (Note uppercase C) or the contrasts function. On Monday, July 23, 2012, Manzoni, GianMauro wrote:
Dear all,
I am quite new to R and I am having trouble writing the polynomial
contrasts for an ordinal factor in MANOVA.
# I have a model such as this
fit<-manova(cbind(Y1,Y2,Y3)~Groups,data=Events) # where groups is an
ordinal factor with 4 levels
# how to set polynomial contrasts for the "Groups" factor ?
Thank you very much in advance for any help!
Best regards,
Mauro
--
Dr. Gian Mauro Manzoni
PhD, PsyD
Psychology Research Laboratory
San Giuseppe Hospital
Istituto Auxologico Italiano
Verbania - Italy
e-mail: gm.manzoni at auxologico.it
cell. phone +39 338 4451207
Tel. +39 0323 514278
[[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.
-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
-- Dr. Gian Mauro Manzoni PhD, PsyD Psychology Research Laboratory San Giuseppe Hospital Istituto Auxologico Italiano Verbania - Italy e-mail: gm.manzoni at auxologico.it cell. phone +39 338 4451207 Tel. +39 0323 514278 [[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.