[R-sig-ME] newbie repeated measures regression questions

Charlie Brown charliethebrown77 at gmail.com
Thu May 10 18:06:22 CEST 2012


Hello,
I have a repeated measures situation and would like some help to determine
if this is 1) appropriate, and 2) how to properly interpret the results.
Unfortunately, these data are very limited (but I have been asked to
analyze them anyway).  Here is an example of the data:

Basically, I have repeated measures of "Y" recorded in consecutive years
(94:98) taken at approximately the same time (July) at the same 6 sites; Y
is a percentage that I would like to regress along the continuous variable
called "env.gradient".

# Data
#######################################################################
dat <- structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L), .Label = c("C1", "C2", "C3", "Q1",
"Q2", "Q3"), class = "factor"), year = c(94L, 95L, 96L, 97L,
98L, 94L, 95L, 96L, 97L, 98L, 94L, 95L, 96L, 97L, 98L, 94L, 95L,
96L, 97L, 98L, 94L, 95L, 96L, 97L, 98L, 94L, 95L, 96L, 97L, 98L
), env.gradient = c(18, 18, 18, 18, 18, 3.5, 3.5, 3.5, 3.5, 3.5,
14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 8, 8, 8, 8, 8, 6.5, 6.5,
6.5, 6.5, 6.5), Y = c(0.171158638926407, 0.169713288641782,
0.152153933837569,
0.197575217418616, 0.203910975101867, 0.0750279002284801,
0.170743241890423,
0.124641793138257, 0.114178607721316, 0.094511173181886, 0.246397132453605,
0.204852712848377, 0.127234745915353, 0.250078422865994, 0.167826032256711,
0.179431760128959, 0.197893902312921, 0.129699846863689, 0.149706090438842,
0.138852795878536, 0.125088313507783, 0.178352158019673, 0.116281351771267,
0.147501950163454, 0.118865506981108, 0.0924414290963082,
0.144984499149044,
0.132532609540349, 0.137715018373314, 0.134704824360581)), .Names =
c("site",
"year", "env.gradient", "Y"), class = "data.frame", row.names = c(NA,
-30L))

# Analysis
#########################################################################
# I am trying to follow Venables and Ripley (2002), Chapter 10.
# I am likely compleely misguided on how to proceed, so please correct me

dat1.lm <- with(dat, lm(Y~as.factor(year)/env.gradient - 1))
summary(dat1.lm)

# if I understand this right, and looking at a graph of the data, this
seems correct, the 1st 6 rows (e.g. "as.factor(year)94  0.0485") are the
intercepts, and the rest are the slope estimates (which makes sense, I've
never run a regression like this). It looks like there is a relatively
large variation in both slopes and intercepts with these data.  I will
assume that I cannot adopt a parallel-line or even same slope model.

# What does "-1" mean in that formula?

# now to the fun stuff
library(nlme)

dat1.lme <- lme(Y ~ as.factor(year) + env.gradient , random=~1|site,
data=dat)
summary(dat1.lme)

# What does "~1" mean in that formula.... random is the 1st variable in the
formula given the site ??

# interpretation
#############################################################################
>From the looks of this summary, all null hypotheses regarding slope are
rejected at the 5% significance level except for 1994, which looking at the
graph, I can see that it likely isn't sig. different from zero.  Further,
all of the slopes are significant except for 1995 and 1996, as these are
relatively flat.  The overall model is significant, but I don't really
understand what that means regarding 95 and 96 since they were not...

Can you please tell me what I have done wrong, need to do additionally, and
how to properly interpret this.

I also have checked none of the assumptions of a linear model at this time,
are these the same as with a simple linear model (which should I be most
concerned about).


THANK YOU for any advice.
Chuck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.png
Type: image/png
Size: 11070 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20120510/c4660c91/attachment-0001.png>


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