# How to incorporate splines of random effects in lme4?

Are splines of random effects allowed in nlme but not in lme4? How to incorporate splines of random effects in lme4?

>library(nlme)
>library(lme4)
>library(splines)
>ctrl <- lmeControl(opt='optim')
>summary(m1 <- lme(conc ~ ns(time, 3), random = ~ ns(time, 3) |Subject, na.action=na.omit, control = ctrl, data = Quinidine))
>summary(m2 <- lmer(conc ~ ns(time, 3) + (ns(time, 3) | Subject), data = Quinidine))
>Error: number of observations (=361) <= number of random effects (=544) for term (ns(time, 3) | Subject); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable


Additionally, should the terms in random effects always be identical with the terms in fixed effects? Is it OK to have ns(time, 3)" in the fixed effects, but time in the random effects?