[R] Simple Nesting question/Odd error message

Thomas Lumley tlumley at u.washington.edu
Tue Nov 8 18:53:39 CET 2005


On Mon, 7 Nov 2005, Jarrett Byrnes wrote:

> I'm attempting to analyze some survey data comparing multiple docks.  I
> surveyed all of the slips within each dock, but as slips are nested
> within docks, getting multiple samples per slip, and don't really
> represent any meaningful gradient, slip is a random effect.  There are
> also an unequal number of slips at each dock.
>
> I'm having syntactical issues, however.  When I try
>
> dock.lme<-lme(X.open ~ Dock, random=Slip|~Dock, data=my.data)

You want ~Slip|Dock, not Slip|~Dock

> I get
>
> Error in inherits(object, "reStruct") : Object "Slip" not found
>
> I'm uncertain as to what this means, as Slip most certainly is there
> (yes, I checked) - any pointers, or pointers about syntax for this as a
> general topic.
>
> And while I'm on it, is there a way to fit models with random effects
> using least squares instead of REML?  Thanks!

I'm not sure what you mean by "using least squares". You can use maximum 
likelihood in lme().

Alternatively, if the random effects are just a nuisance rather than the 
target of inference, and if your survey has a well-defined sampling scheme 
you might want to use svyglm() in the "survey" package.

 	-thomas




More information about the R-help mailing list