[R] Syntax for random effect in glmmPQL

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 19 11:23:59 CEST 2003


It is the same syntax as for lme.

I think you meant two *independent* variables.  I don't see the point of
treating a factor with two levels as a random effect: you don't really
expect to estimate a population from just two samples, do you?  If (as I
suspect) the sites are blocking factors they should be treated as fixed
effects (just as randomized block designs are analysed), or if you are
interested in the population of sites you should get several more.

A pedagogical hint to R-help readers:

You don't just have a data set:  you have an experiment or an
observational study you want to analyse.  If you had described the latter,
we might have been able to do better than guess at what you meant.

On Mon, 19 May 2003, Mikael Niva wrote:

> Dear R-listers
> 
> I wonder if someone can help me with the syntax for the random effect in
> glmmPQL()? I have a data set with a response variable "y" (counts), two
> dependent variables: "treat" (4 levels) and "site" (2 levels). The
> latter, I want to use as a random variable. How do I specify this in the
> function?
> 
> Is it like this: glmmPQL(y~treat,random=~1|site,family=poisson,
> data=mydata)? What does the ~1 do?

That gives you a random intercept by site.

-- 
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