Michael Hopkins
2010-Oct-12 14:55 UTC
[R] general construction of 'all pairwise comparison' contrast in ANOVA
Hi R people I am using regsubsets() to fit large numbers of models and collect summary statistics in order to perform a Bayesian analysis of multi-way ANOVA with specific prior information. In general the variables have differing numbers of levels >=2. This works well but with variable of more than 2 levels there are naturally some arbitrary decisions about which treatment contrasts to include in the model matrix. It's obviously easy to choose the 'standard' contrasts using options( contrasts = c( "contr.sum", "contr.poly" )) with contr.helmert, contr.sum or contr.treatment as required. However, what I would really like is a set of all pairwise comparison contrasts, and preferably in a form that can be fed straight to regsubsets() so that all labelling, fitting, output etc is automatically dealt with. Are there any functions or libraries in R that will allow me to do this without too much grief? Thanks in advance Michael Hopkins Algorithm and Statistical Modelling Expert Upstream 23 Old Bond Street London W1S 4PZ Mob +44 0782 578 7220 DL +44 0207 290 1326 Fax +44 0207 290 1321 hopkins@upstreamsystems.com www.upstreamsystems.com [[alternative HTML version deleted]]