[R] questions please

Jason Turner jasont at indigoindustrial.co.nz
Fri Oct 24 21:36:16 CEST 2003


Simone Panigada wrote:
...
>     *  I am running a glm to model animal abundance relating it to research 
> effort and other variables. I have 10 years of data and I am treating year 
> as a factor, R is comparing each year with the first year my data sheet, 
> while I would like to compare each year with each other. Is there any 
> function in R to do this?
...

Short answer:

If your model was glm(critters ~ year, ...), change this to

your.model <- glm(critters ~ year - 1,...)

In other words, drop the intercept if you don't want to compare to a 
particular year.  A model that defines coefficients for each year *and* 
an overall intercept is over-defined; there's no additional information 
given by the extra term.

You might also benefit from the package multcomp (which requires 
mvtnorm) which has the function simint().

Long answer:

Get your hands on a copy of "Modern Applied Statistics with S" by 
Venables and Ripley, and read chapters 6 and 7 rather thoroughly.  This 
goes into the reasons behind the choice of comparing one year to others.

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz




More information about the R-help mailing list