[R] What is the effect of how.many in the "contrast" function
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Feb 14 07:41:24 CET 2014
There is no contrast() function in R itself, but this seems to be about
contrasts().
On 14/02/2014 04:35, jimj wrote:
> I have been asked to see if there is a linear trend in 3 groups of data (5
> points each) by using ANOVA and linear contrasts. The 3 groups represent
> data collected in 2010,2011 and 2012. I want to use R for this procedure and
> I have tried both of the following:
>
> contrasts(data$groups, how.many=1) <- contr.poly(3)
> contrasts(data$groups) <- contr.poly(3)
>
> Both ways seem to work fine but give slightly different answers in terms of
> their p-values. I have no idea which is correct and it is really tricky to
> find help for this on the web. I would like help figuring out what is the
> reasoning behind the different answers. I'm not sure if it has something to
> do with partitioning sums of squares or whatnot. Thanks so much for your
> help.
You should always read the help page, which does explain this. Maybe
you need the background of Chapter 6 of MASS (the book)?
>
> ______________________________________________
> 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.
>
Please do. Had you shown an example we could probably have explained
this to you.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list