Displaying 1 result from an estimated 1 matches for "ncows".
Did you mean:
ncols
2006 Apr 06
1
polynomial predict with lme
...are wildly off.
Or am I doing something daft?
Milk yield for five cows is measured weekly for 45 weeks.
Yield is simulated as cubic function of weekno + random
cow effect (on intercept) + residual error.
I want to recover an estimate of the fixed curve.
###############
library(nlme)
set.seed(1)
ncows <- 5; nweeks <- 45; week <- 1:nweeks
mcurve <- 25 + 0.819*week - 0.0588*week^2 + 0.000686*week^3
cow.eff <- rnorm(ncows)
week <- rep(week, ncows)
cow <- gl(ncows,nweeks)
yield <- mcurve + cow.eff[cow] + rnorm(ncows*nweeks)
lmefit <- lme(yield ~ poly(week,3), random = ~1|...