Skip to content

advise for modeling a linear mixed model

3 messages · Frank, Jason Turner, Douglas Bates

#
Dear R help-list reader,

I'm trying to investigate my data with linear mixed model and are 
seeking advise how to write the model in R. I was trying to get hold 
of the recommended book from Bates et al, but neither the major 
bookshop nor our university library had the book. My data is 
mirroring the example given in the appendix of John Foxes book 
"Applied Regression" with a small exception.

I'm interested in a frequency (freq) of a particular cell type which 
was measured longitudinal in patients (p) and  control group (c). In 
addition, each sample was measured four times (repeat) with a 
possible factor influencing the sensitivity (gated).

Here my data frame:

ID	freq	day	repeat	group	gated
1	0.1	1	1	c	10000
1	0.15	1	2	c	12000
1	0.2	1	3	c	50000
1	0.1	1	4	c	12000
1	0.5	12	1	c	12000
1	0.1	12	2	c	50000
1	0.2	12	3	c	100000
1	0.4	12	4	c	70000
1	0.2	5	1	p	15000
2	0.25	5	2	p	6000
2	.
2	.

So I could write a model with a fixed effects for day and group and 
their interaction.

lme(freq ~ day*group, random = ~day | ID data=frame)

I'm expecting possible effect of "gated" on the frequency. I don't 
know how to include the fact that I have four measures from the same 
sample and an effect of the variable "gated" on the frequency.

I'm appreciate any help, and apologize in case I have not read 
carefully the available documentation.

Frank
#
Frank Mattes wrote:
...


Is gated a continuous variable?  You could compare it as...

(gated as fixed effect)

lme(freq ~ day*group + gated, random = ~day | ID data=frame,
   method = "ML")

vs

(gated as random effect)

lme(freq ~ day*group, random = ~day + gated | ID data=frame,
   method = "ML")

and use anova() to compare.  Note that you'll need the "ML" as opposed 
to REML to compare using anova.

Or have I missed something?

check out ?corClasses, too, to help with correlated error terms.

As for the book, Bates & Pinheiro, I'm working my way slowly through it, 
and it's well worth it.  Well written, and very informative.  The 
"slowly" working through it is because my spare time is very short these 
days.  I strongly urge you to purchase it from your favorite on-line 
book retailer (or pop by Foyles to grab one - just a couple blocks up 
from Charring Cross station, if memory serves).

In the mean time, if you can't immediately grab a copy, go over here:

http://www.insightful.com/support/documentation.asp?DID=3

and select "S-PLUS 6 Guide to Statistics (Part I)", and read the chapter 
on Linear and Non-Linear Mixed-effects models (Chapter 14 in my copy). 
I've got this, and a copy of Bates & Pinheiro.  The free guide isn't 
bad, B&P is excellent.

Cheers

Jason
#
Jason Turner <jasont at indigoindustrial.co.nz> writes:
Actually, it's "Pinheiro & Bates".