Skip to content
Prev 10355 / 20628 Next

modeling effects in multiple data frames

Emmanuel Curis <emmanuel.curis at ...> writes:
More specifically,

datList <- lapply(list.files(...),read.table)
nvec <- sapply(datList,nrow)
d <- cbind(do.call(rbind,datList),id=rep(1:length(datList),nvec))

lme4(out~poly(time,2,raw=TRUE)+(poly(time,2,raw=TRUE)|id),data=d)

Note that time^2 won't work as expected in a formula context; you either need

1 + time + I(time^2)

or

poly(time,2)  ## orthogonal polynomial

or

poly(time,2,raw=TRUE)  ## regular polynomial

  orthogonal polynomials are probably better unless you need
to be able to interpret the parameters in a specific way

[snip]