[R] nlme for groupedData with inner and outer factors

Spencer Graves spencer.graves at pdf.com
Wed Mar 29 20:58:52 CEST 2006

```	  1.  Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S
and S-Plus (Springer)?  If no, I believe your study of that book will be
well rewarded;  mine has.

2.  If you've looked at Pinheiro and Bates and still have questions
developing a toy example that is as simple as you can make it that still
illustrates your question.  I've solved many of my own problems doing
this, and I've answered many questions for people on this list dealing
with functions I've not previously used.  You could help people like me
by providing a few lines of R code that we could copy from your email,
paste into R and replicate what you see.

hope this helps,
spencer graves

Dan Bebber wrote:

> Hello,
>
> I am having trouble specifying a suitable nlme model.
> My data structure is described by
>
> gd <- groupedData(ppath ~ lcut | exp, outer = ~ bait, inner = ~ weight, data
> = d)
>
> i.e. the response (ppath) of several subjects (sub) was measured at levels
> of a continuous variable (lcut). Subjects were given either of one level of
> a factor (bait), and all subjects were measured at two levels of another
> factor (weight). Therefore bait varies among subjects and weight varies
> within subjects.
>
> The relationship ppath ~ cut for each subject and weight appear to follow a
> logistic curve, with xmid and scal affected by bait and weight. There is
> also a random effect of subject on xmid and scal.
>
> Any help with formulating the correct model would be greatly appreciated.
>
> Many thanks,
> Dan Bebber
>
> Department of Plant Sciences
> University of Oxford
>
> p.s. Part of my data are shown below:
>
>      sublcut       ppath bait weight
> 1   pv1_  0.0 1.000000000    1      0
> 2   pv1_  0.1 0.827773821    1      0
> 3   pv1_  0.2 0.380102502    1      0
> 4   pv1_  0.3 0.209151878    1      0
> 5   pv1_  0.4 0.076929304    1      0
> 6   pv1_  0.5 0.065681564    1      0
> 7   pv1_  0.6 0.020670108    1      0
> 8   pv1_  0.7 0.012817021    1      0
> 9   pv1_  0.8 0.008661514    1      0
> 10  pv1_  0.9 0.011568323    1      0
> 11  pv19  0.0 1.000000000    1      0
> 12  pv19  0.1 0.668390291    1      0
> 13  pv19  0.2 0.343318462    1      0
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help