[R-sig-ME] Nested longitudinal

Robert Kushler kushler at oakland.edu
Tue Apr 24 17:30:17 CEST 2012


I'm breaking my own rules by offering answers before getting answers to my own
questions.  However:

1) The simple general answer to your basic question is that the "/" character
is used to represent nested factors, while a "*" is used to indicate "crossed"
factors that might interact.  Your use of "+" in the model formula below means
you are *assuming* that the factors do not interact - and assuming something
doesn't make it true.   :-)

2) If both strains are tested at both wavelengths, then the factors are crossed.
However, treating them as nested produces an alternative parametrization that
may be easier to interpret.  If you use "Wavelength*Strain" the three resulting
parameters will represent traditional "main effect" and "interaction" terms,
while using "Wavelength/Strain" will yield a "main effect" for Wavelength and
two "simple effects" for Strain (one for each "Wavelength).  The difference
between the latter two parameters indirectly represents the interaction.

3) Unless you use the same "subject" more that once, "subject" is nested in
"Startingresponse" rather than the other way around.  (Is it really a response,
or did you place the subjects in their initial positions?  Perhaps the factor
should be called "Startingcondition".)

4) It seems to me that there will be very strong serial correlation in the 15
measurements on an individual subject.  Unfortunately lmer doesn't include this
as a modeling option.  Your current syntax does one of the following:  (a) fits
a linear "time effect" with a random slope and intercept or (b) if time is a factor
you are trying to estimate an "unstructured" (sorry, Doug Bates) 15 by 15 matrix.
Both approaches are problematic here.  I suggest you collapse the data by time and
record y = number of minutes (out of 15) spent in light (or dark - doesn't matter)
areas, and then use "cbind(y,15-y)" as the response.  You probably should also try
some alternatives to the binomial family (e.g., "quasibinomial").

Regards,   Rob Kushler



On 4/24/2012 12:40 AM, arun wrote:
> Hi,
>
> I have some difficulty in figuring out whether I am doing correct or not.
>
>
> A brief introduction about the work: It is a light/dark choice test
> conducted in insect larvae.  The response is binary (0- present in dark
> area, 1-present in light area) and the experiment is run for 15 min, so
> there are 15 measurements per individual larva at 1 min
> intervals.  The factors which affect this study are Strain (2 levels-G
> and S),  wavelength of light (4 levels-blue, green, UV, red), and
> starting response at 0 min (two levels- animal present in dark-D or
> light-L).  This is how I think it is nested.  Strain nested inside
> Wavelength, Subject (individual) nested within strain, Starting response within subject, and time within Starting response.   The data looks like this:
>
>           Number              Wavelength     Strain             Subject           Startingresponse              time (min)
>                  1                        Red              G                   1                          L                               1
>                  2                        Red              G                   1                          L                               2
>              ---------------------------------------------------------------------------------------------------------------
>          ---------------------------------------------------------------------------------------------------------------------
>                20
>   Red              G                     1                         L                                20
>                 21                      Red              G                      2                        D                                1
>                  22                      Red               G                    2                        D                                2
>
>              ---------------------------------------------------------------------------------------------------------------
>
>      -----------------------------------------------------------------------------------------------------------------------
>
>   40                      Red               G                      2
>                     D                             20
>
>   -----------------------------------------------------------------------------------------------------------------
>               ----------------------------------------------------------------------------------------------------------------
>
>             121                     Green             G
>     7                           D                             1
>              122                    Green              G                    7                           D                             2
>     ------------------------------------------------------------------------------------------------------------------------
> ---------------------------------------------------------------------------------------------------------------------------
>
> The model I used was:
>
>
> (fm2<-lmer(Response~Wavelength+Startingresponse+Strain+ time + (time|Subject),family=binomial, data=Behavdat))
>
> I am not sure how to specify the nested structures
>   within the
>   model.
>
> Any help will be appreciated.
> Thanks.
> 	[[alternative HTML version deleted]]
>
>
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list